# HG changeset patch # User Paul Boddie # Date 1531863023 -7200 # Node ID fe4054485f21caba4ef3b73976e26a9273b688c9 # Parent 727abfd0f8babd8a36acb8865ae7f648c0216c62# Parent 27f1e816fb4999d2492a7e1b16c5c16946d72d51 Merged development, excluding longest match changes. diff -r 727abfd0f8ba -r fe4054485f21 moinformat/parsers/common.py diff -r 727abfd0f8ba -r fe4054485f21 moinformat/parsers/table.py --- a/moinformat/parsers/table.py Tue Jul 17 23:27:57 2018 +0200 +++ b/moinformat/parsers/table.py Tue Jul 17 23:30:23 2018 +0200 @@ -22,7 +22,8 @@ from moinformat.parsers.common import get_patterns, \ excl, expect, group from moinformat.parsers.moin import MoinParser -from moinformat.tree import Table, TableAttrs, TableCell, TableRow, Text +from moinformat.tree import Continuation, Table, TableAttrs, TableCell, \ + TableRow, Text join = "".join @@ -73,7 +74,11 @@ # Parser handler methods. def parse_continuation(self, cell): - pass + + "Handle continuation padding." + + feature = self.match_group("feature") + cell.append(Continuation(feature)) def parse_table_end(self, cell): @@ -99,17 +104,16 @@ excl(r".*==\s*?$"), # not-heading expect(r"\N*?"))), # ws-excl-nl - "continuation" : join(("^", + "continuation" : group("feature", + join(("^", group("indent", r"\N*"), # ws... (optional) r"\.\.", # .. - excl(r"\."), # not-. - expect(r"\N"))), # ws + excl(r"\.")))), # not-. # Within text: "columnsep" : join((r"\|\|", # || - excl(r"\|"), # not-| - expect(r"\N"))), # ws + excl(r"\|"))), # not-| }) patterns = get_patterns(syntax) diff -r 727abfd0f8ba -r fe4054485f21 moinformat/serialisers/html.py --- a/moinformat/serialisers/html.py Tue Jul 17 23:27:57 2018 +0200 +++ b/moinformat/serialisers/html.py Tue Jul 17 23:30:23 2018 +0200 @@ -211,6 +211,9 @@ def break_(self): pass + def continuation(self, text): + pass + def rule(self, length): self.out("
" % min(length, 10)) diff -r 727abfd0f8ba -r fe4054485f21 moinformat/serialisers/moin.py --- a/moinformat/serialisers/moin.py Tue Jul 17 23:27:57 2018 +0200 +++ b/moinformat/serialisers/moin.py Tue Jul 17 23:30:23 2018 +0200 @@ -172,6 +172,9 @@ def break_(self): self.out("\n") + def continuation(self, text): + self.out(text) + def rule(self, length): self.out("-" * length) diff -r 727abfd0f8ba -r fe4054485f21 moinformat/tree.py --- a/moinformat/tree.py Tue Jul 17 23:27:57 2018 +0200 +++ b/moinformat/tree.py Tue Jul 17 23:30:23 2018 +0200 @@ -151,6 +151,8 @@ +# Block nodes. + class Block(Container): "A block in the page." @@ -400,6 +402,8 @@ +# Inline nodes. + class Inline(Container): "Generic inline formatting." @@ -499,6 +503,8 @@ +# Nodes without children. + class Node: "A document node without children." @@ -519,6 +525,22 @@ def to_string(self, out): out.break_() +class Continuation(Node): + + "Continuation padding for table content." + + def __init__(self, text): + self.text = text + + def __repr__(self): + return "Continuation(%r)" % self.text + + def prettyprint(self, indent=""): + return "%sContinuation: %r" % (indent, self.text) + + def to_string(self, out): + out.continuation(self.text) + class Rule(Node): "A horizontal rule." diff -r 727abfd0f8ba -r fe4054485f21 tests/test_continuation.tree --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_continuation.tree Tue Jul 17 23:30:23 2018 +0200 @@ -0,0 +1,27 @@ +Region + Region + Table + TableRow + TableCell + FontStyle + Text + Text + TableCell + Text + FontStyle + Text + Text + TableRow + TableCell + Text + TableCell + Text + Link + Text + Text + Continuation + Text + Link + Text + Text + Block diff -r 727abfd0f8ba -r fe4054485f21 tests/test_continuation.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_continuation.txt Tue Jul 17 23:30:23 2018 +0200 @@ -0,0 +1,6 @@ +{{{#!table +'''Release''' || '''Details''' +== +0.1 || [[http://hgweb.boddie.org.uk/Lichen/rev/rel-0-1|changeset]] + .. [[http://hgweb.boddie.org.uk/Lichen/file/rel-0-1|files]] +}}}