Skip to content

Commit

Permalink
Oppdater metadatarst2yaml til å håndtere nytt tabellformat.
Browse files Browse the repository at this point in the history
  • Loading branch information
petterreinholdtsen committed Apr 4, 2020
1 parent eeebf21 commit ab405c0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/metadatarst2yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,20 @@ class MetadataRstVisitor(docutils.nodes.NodeVisitor):

class MetadataObjSortRstVisitor(docutils.nodes.NodeVisitor):
metadata = {}
intable = False

def visit_table(self, node: docutils.nodes.reference) -> None:
"""Called for "table" nodes."""
self.intable = True

def depart_table(self, node: docutils.nodes.reference) -> None:
"""Called for "table" nodes."""
self.intable = False

def visit_title(self, node: docutils.nodes.reference) -> None:
"""Called for "title" nodes to record metadata category."""
self.lasttitle = node.astext()
if not self.intable:
self.lasttitle = node.astext()

def visit_row(self, node: docutils.nodes.reference) -> None:
"""Called for "table row" nodes."""
Expand Down

0 comments on commit ab405c0

Please sign in to comment.