1.1 --- a/moinformat/parsers/table.py Wed Oct 06 00:16:28 2021 +0200
1.2 +++ b/moinformat/parsers/table.py Sat Oct 09 00:34:01 2021 +0200
1.3 @@ -65,11 +65,13 @@
1.4 break
1.5
1.6 elif pattern == "columnsep":
1.7 - cell = TableCell([])
1.8 + cell = TableCell([], leading=self.match_group("leading"),
1.9 + padding=self.match_group("padding"))
1.10 row.append(cell)
1.11
1.12 elif pattern == "rowsep":
1.13 - row = TableRow([])
1.14 + row = TableRow([], leading=self.match_group("leading"),
1.15 + padding=self.match_group("padding"))
1.16 table.append(row)
1.17 cell = TableCell([])
1.18 row.append(cell)
1.19 @@ -92,20 +94,25 @@
1.20 syntax.update({
1.21 # At start of line:
1.22
1.23 - "rowsep" : join(("^==", # ==
1.24 + "rowsep" : join((group("leading", r"\s*"), # ws... (optional)
1.25 + "^==", # ==
1.26 excl(r".*==\s*?$"), # not-heading
1.27 - expect(r"\N*?"))), # ws-excl-nl
1.28 + group("padding", r"\s*"))), # ws... (optional)
1.29
1.30 "continuation" : group("feature",
1.31 - join(("^",
1.32 - group("indent", r"\N*"), # ws... (optional)
1.33 + join((group("leading", r"\s*"), # ws... (optional)
1.34 + "^",
1.35 + group("indent", r"\s*"), # ws... (optional)
1.36 r"\.\.", # ..
1.37 - excl(r"\.")))), # not-.
1.38 + excl(r"\."), # not-.
1.39 + group("padding", r"\s*")))),# ws... (optional)
1.40
1.41 # Within text:
1.42
1.43 - "columnsep" : join((r"\|\|", # ||
1.44 - excl(r"\|"))), # not-|
1.45 + "columnsep" : join((group("leading", r"\s*"), # ws... (optional)
1.46 + r"\|\|", # ||
1.47 + excl(r"\|"), # not-|
1.48 + group("padding", r"\s*"))), # ws... (optional)
1.49 })
1.50
1.51 patterns = get_patterns(syntax)