1.1 --- a/moinformat/parsers/table.py Sun Jul 15 14:19:42 2018 +0200
1.2 +++ b/moinformat/parsers/table.py Sun Jul 15 19:20:41 2018 +0200
1.3 @@ -19,11 +19,12 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from moinformat.parsers.common import get_patterns
1.8 +from moinformat.parsers.common import get_patterns, \
1.9 + excl, expect, group
1.10 from moinformat.parsers.moin import MoinParser
1.11 from moinformat.tree import Table, TableAttrs, TableCell, TableRow, Text
1.12
1.13 -
1.14 +join = "".join
1.15
1.16 # Parser functionality.
1.17
1.18 @@ -90,11 +91,22 @@
1.19 syntax.update(MoinParser.syntax)
1.20 syntax.update({
1.21 # At start of line:
1.22 - "rowsep" : r"^==(?!.*==\s*?$)(?=\N*?)", # == not-heading ws-excl-nl
1.23 - "continuation" : r"^(\N*)\.\.(?!\.)(?=\N)", # .. ws-excl-nl or .. not-dot
1.24 +
1.25 + "rowsep" : join(("^==", # ==
1.26 + excl(r".*==\s*?$"), # not-heading
1.27 + expect(r"\N*?"))), # ws-excl-nl
1.28 +
1.29 + "continuation" : join(("^",
1.30 + group("indent", r"\N*"), # ws... (optional)
1.31 + r"\.\.", # ..
1.32 + excl(r"\."), # not-.
1.33 + expect(r"\N"))), # ws
1.34
1.35 # Within text:
1.36 - "columnsep" : r"\|\|(?!\|)(?=\N)", # || ws-excl-nl or || not-pipe
1.37 +
1.38 + "columnsep" : join((r"\|\|", # ||
1.39 + excl(r"\|"), # not-|
1.40 + expect(r"\N"))), # ws
1.41 })
1.42
1.43 patterns = get_patterns(syntax)
1.44 @@ -104,7 +116,7 @@
1.45 # Pattern details.
1.46
1.47 table_region_pattern_names = MoinParser.region_pattern_names + [
1.48 - "columnsep", "continuation", "regionend", "rowsep",
1.49 + "columnsep", "continuation", "rowsep",
1.50 ]
1.51
1.52