# HG changeset patch # User Paul Boddie # Date 1635118007 -7200 # Node ID f24099c58d7867e3c75d30bd30dc5f6696eecc32 # Parent e269a9f0104069129b94d639b2d9d11e57d18691 Eliminate breaks at the start of table regions where a blank line has been left for clarity. diff -r e269a9f01040 -r f24099c58d78 moinformat/parsers/table.py --- a/moinformat/parsers/table.py Mon Oct 25 00:55:44 2021 +0200 +++ b/moinformat/parsers/table.py Mon Oct 25 01:26:47 2021 +0200 @@ -58,6 +58,15 @@ while True: self.parse_region_details(cell, self.region_pattern_names) + # Suppress any initial paragraph break within a table cell. This is + # caused by a blank line which might be employed for clarity. + + first = cell.node(0) + + if isinstance(first, Break): + cell.remove(first) + cell.padding += "\n" + # Detect the end of the table. pattern = self.matching_pattern() diff -r e269a9f01040 -r f24099c58d78 moinformat/serialisers/moin/table.py --- a/moinformat/serialisers/moin/table.py Mon Oct 25 00:55:44 2021 +0200 +++ b/moinformat/serialisers/moin/table.py Mon Oct 25 01:26:47 2021 +0200 @@ -38,9 +38,9 @@ if not self.first_cell: self.out(leading) self.out("||") - self.out(padding) else: self.first_cell = False + self.out(padding) def start_table_row(self, leading, padding): self.first_cell = True diff -r e269a9f01040 -r f24099c58d78 tests/test_table_parser.tree --- a/tests/test_table_parser.tree Mon Oct 25 00:55:44 2021 +0200 +++ b/tests/test_table_parser.tree Mon Oct 25 01:26:47 2021 +0200 @@ -53,7 +53,6 @@ Table TableRow TableCell - Break Block Text TableCell