# HG changeset patch # User Paul Boddie # Date 1692307998 -7200 # Node ID 9f6181276b350eb813f5006090e4963350538e8d # Parent 3a826101949a45f8ca3714733b871a2fbac67452 Return nodes when visiting so that document translation can be supported. diff -r 3a826101949a -r 9f6181276b35 moinformat/tree/graphviz.py --- a/moinformat/tree/graphviz.py Thu Aug 17 22:50:30 2023 +0200 +++ b/moinformat/tree/graphviz.py Thu Aug 17 23:33:18 2023 +0200 @@ -40,6 +40,6 @@ return "Directive(%r, %r, %r)" % (self.key, self.value, self.directive) def visit(self, visitor): - visitor.directive(self) + return visitor.directive(self) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 3a826101949a -r 9f6181276b35 moinformat/tree/moin.py --- a/moinformat/tree/moin.py Thu Aug 17 22:50:30 2023 +0200 +++ b/moinformat/tree/moin.py Thu Aug 17 23:33:18 2023 +0200 @@ -206,7 +206,7 @@ self.indent, self.type, self.args, self.transparent, self.extra) def visit(self, visitor): - visitor.region(self) + return visitor.region(self) @@ -220,7 +220,7 @@ return "Block(%r)" % self.nodes def visit(self, visitor): - visitor.block(self) + return visitor.block(self) class DefItem(Container): @@ -235,7 +235,7 @@ return "DefItem(%r, %r, %r)" % (self.nodes, self.pad, self.extra) def visit(self, visitor): - visitor.defitem(self) + return visitor.defitem(self) class DefTerm(Container): @@ -250,7 +250,7 @@ return "DefTerm(%r, %r, %r)" % (self.nodes, self.pad, self.extra) def visit(self, visitor): - visitor.defterm(self) + return visitor.defterm(self) class FontStyle(Container): @@ -279,7 +279,7 @@ return "FontStyle(%r, %r, %r)" % (self.nodes, self.emphasis, self.strong) def visit(self, visitor): - visitor.fontstyle(self) + return visitor.fontstyle(self) class Heading(Container): @@ -301,7 +301,7 @@ self.end_pad, self.end_extra, self.identifier) def visit(self, visitor): - visitor.heading(self) + return visitor.heading(self) class LinkLabel(Container): @@ -311,7 +311,7 @@ return "LinkLabel(%r)" % self.nodes def visit(self, visitor): - visitor.link_label(self) + return visitor.link_label(self) class LinkParameter(Container): @@ -321,7 +321,7 @@ return "LinkParameter(%r)" % self.nodes def visit(self, visitor): - visitor.link_parameter(self) + return visitor.link_parameter(self) class List(Container): @@ -343,7 +343,7 @@ def visit(self, visitor): if not self.first: self.init() - visitor.list(self) + return visitor.list(self) class ListItem(Container): @@ -364,7 +364,7 @@ return "ListItem(%r, %r, %r, %r, %r)" % (self.nodes, self.indent, self.marker, self.space, self.num) def visit(self, visitor): - visitor.listitem(self) + return visitor.listitem(self) class Table(Container): @@ -374,7 +374,7 @@ return "Table(%r)" % self.nodes def visit(self, visitor): - visitor.table(self) + return visitor.table(self) class TableAttrs(Container): @@ -393,7 +393,7 @@ return "TableAttrs(%r)" % self.nodes def visit(self, visitor): - visitor.table_attrs(self) + return visitor.table_attrs(self) class TableCell(Container): @@ -410,7 +410,7 @@ self.leading, self.padding) def visit(self, visitor): - visitor.table_cell(self) + return visitor.table_cell(self) class TableRow(Container): @@ -427,7 +427,7 @@ self.leading, self.padding) def visit(self, visitor): - visitor.table_row(self) + return visitor.table_row(self) @@ -445,7 +445,7 @@ "Larger text." def visit(self, visitor): - visitor.larger(self) + return visitor.larger(self) class Link(Container): @@ -459,7 +459,7 @@ return "Link(%r, %r)" % (self.nodes, self.target) def visit(self, visitor): - visitor.link(self) + return visitor.link(self) class Macro(Container): @@ -479,42 +479,42 @@ self.nodes, self.inline) def visit(self, visitor): - visitor.macro(self) + return visitor.macro(self) class Monospace(Inline): "Monospaced text." def visit(self, visitor): - visitor.monospace(self) + return visitor.monospace(self) class Smaller(Inline): "Smaller text." def visit(self, visitor): - visitor.smaller(self) + return visitor.smaller(self) class Strikethrough(Inline): "Crossed-visitor text." def visit(self, visitor): - visitor.strikethrough(self) + return visitor.strikethrough(self) class Subscript(Inline): "Subscripted text." def visit(self, visitor): - visitor.subscript(self) + return visitor.subscript(self) class Superscript(Inline): "Superscripted text." def visit(self, visitor): - visitor.superscript(self) + return visitor.superscript(self) class Transclusion(Container): @@ -528,14 +528,14 @@ return "Transclusion(%r, %r)" % (self.nodes, self.target) def visit(self, visitor): - visitor.transclusion(self) + return visitor.transclusion(self) class Underline(Inline): "Underlined text." def visit(self, visitor): - visitor.underline(self) + return visitor.underline(self) @@ -559,7 +559,7 @@ return "Anchor(%r)" % self.target def visit(self, visitor): - visitor.anchor(self) + return visitor.anchor(self) class Break(Node): @@ -569,7 +569,7 @@ return "Break()" def visit(self, visitor): - visitor.break_(self) + return visitor.break_(self) class Comment(Node): @@ -583,7 +583,7 @@ return "Comment(%r, %r)" % (self.comment, self.extra) def visit(self, visitor): - visitor.comment(self) + return visitor.comment(self) class Directive(Node): @@ -597,7 +597,7 @@ return "Directive(%r, %r)" % (self.directive, self.extra) def visit(self, visitor): - visitor.directive(self) + return visitor.directive(self) class LineBreak(Node): @@ -607,7 +607,7 @@ return "LineBreak()" def visit(self, visitor): - visitor.linebreak(self) + return visitor.linebreak(self) class NonBreakingSpace(Node): @@ -617,7 +617,7 @@ return "NonBreakingSpace()" def visit(self, visitor): - visitor.nbsp(self) + return visitor.nbsp(self) class Rule(Node): @@ -630,7 +630,7 @@ return "Rule(%d)" % self.height def visit(self, visitor): - visitor.rule(self) + return visitor.rule(self) class TableAttr(Node): @@ -646,7 +646,7 @@ return "TableAttr(%r, %r, %r, %r)" % (self.name, self.value, self.concise, self.quote) def visit(self, visitor): - visitor.table_attr(self) + return visitor.table_attr(self) class Text(Node): @@ -668,7 +668,7 @@ return "Text(%r)" % self.s def visit(self, visitor): - visitor.text(self) + return visitor.text(self) class Verbatim(Node): @@ -681,6 +681,6 @@ return "Verbatim(%r)" % self.text def visit(self, visitor): - visitor.verbatim(self) + return visitor.verbatim(self) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 3a826101949a -r 9f6181276b35 moinformat/tree/pretty.py --- a/moinformat/tree/pretty.py Thu Aug 17 22:50:30 2023 +0200 +++ b/moinformat/tree/pretty.py Thu Aug 17 23:33:18 2023 +0200 @@ -33,7 +33,7 @@ return "Node(%r, %r)" % (self.name, self.nodes) def visit(self, visitor): - visitor.node(self) + return visitor.node(self) def append(self, node): self.nodes.append(node) diff -r 3a826101949a -r 9f6181276b35 moinformat/tree/table.py --- a/moinformat/tree/table.py Thu Aug 17 22:50:30 2023 +0200 +++ b/moinformat/tree/table.py Thu Aug 17 23:33:18 2023 +0200 @@ -32,6 +32,6 @@ return "Continuation(%r)" % self.text def visit(self, visitor): - visitor.continuation(self) + return visitor.continuation(self) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 3a826101949a -r 9f6181276b35 moinformat/utils/htmlparse/tree.py --- a/moinformat/utils/htmlparse/tree.py Thu Aug 17 22:50:30 2023 +0200 +++ b/moinformat/utils/htmlparse/tree.py Thu Aug 17 23:33:18 2023 +0200 @@ -30,7 +30,7 @@ return "%s(%r, %r)" % (self.__class__.__name__, self.name, self.value) def visit(self, visitor): - visitor.attribute(self) + return visitor.attribute(self) @@ -44,7 +44,7 @@ return "%s(%r)" % (self.__class__.__name__, self.nodes) def visit(self, visitor): - visitor.fragment(self) + return visitor.fragment(self) class Element(Fragment): def __init__(self, name, attributes=None, nodes=None): @@ -56,7 +56,7 @@ return "%s(%r, %r, %r)" % (self.__class__.__name__, self.name, self.attributes, self.nodes) def visit(self, visitor): - visitor.element(self) + return visitor.element(self) @@ -70,7 +70,7 @@ return "%s(%r)" % (self.__class__.__name__, self.value) def visit(self, visitor): - visitor.node(self) + return visitor.node(self) class AttributeValue(Node): def __init__(self, value, quote): @@ -81,22 +81,22 @@ return "%s(%r, %r)" % (self.__class__.__name__, self.value, self.quote) def visit(self, visitor): - visitor.attribute_value(self) + return visitor.attribute_value(self) class Comment(Node): def visit(self, visitor): - visitor.comment(self) + return visitor.comment(self) class Directive(Node): def visit(self, visitor): - visitor.directive(self) + return visitor.directive(self) class Inclusion(Node): def visit(self, visitor): - visitor.inclusion(self) + return visitor.inclusion(self) class Text(Node): def visit(self, visitor): - visitor.text(self) + return visitor.text(self) # vim: tabstop=4 expandtab shiftwidth=4