1.1 --- a/moinformat/__init__.py Sun Apr 30 01:43:33 2017 +0200
1.2 +++ b/moinformat/__init__.py Sun Apr 30 17:59:52 2017 +0200
1.3 @@ -19,7 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from moinformat.tree import Block, Heading, ListItem, Region, Rule, Text
1.8 +from moinformat.tree import Block, Break, Heading, ListItem, Region, Rule, Text
1.9 import re
1.10
1.11 # Regular expressions.
1.12 @@ -36,11 +36,15 @@
1.13 "break" : r"^(\s*?)\n",
1.14 # [ws...] =... ws... expecting headingend
1.15 "heading" : r"^(\s*)(?P<x>=+)(\s+)(?=.*?\s+(?P=x)\s*\n)",
1.16 - # indent (list-item or number-item or alpha-item or roman-item or dot-item)
1.17 + # indent list-item [ws...]
1.18 "listitem" : r"^(\s+)(\*)(\s*)",
1.19 + # indent number-item ws...
1.20 "listitem_num" : r"^(\s+)(\d+\.)(\s+)",
1.21 + # indent alpha-item ws...
1.22 "listitem_alpha": r"^(\s+)([aA]\.)(\s+)",
1.23 + # indent roman-item ws...
1.24 "listitem_roman": r"^(\s+)([iI]\.)(\s+)",
1.25 + # indent dot-item [ws...]
1.26 "listitem_dot" : r"^(\s+)(\.)(\s*)",
1.27
1.28 # Region contents:
1.29 @@ -226,11 +230,7 @@
1.30
1.31 "Handle a paragraph break within 'region'."
1.32
1.33 - # Mark any previous block as not being the final one in a sequence.
1.34 -
1.35 - block = region.last()
1.36 - if isinstance(block, Block):
1.37 - block.final = False
1.38 + region.add(Break())
1.39 new_block(region)
1.40
1.41 def parse_heading(items, region):
1.42 @@ -326,7 +326,7 @@
1.43 "Start a new block in 'region'."
1.44
1.45 block = Block([])
1.46 - region.append(block)
1.47 + region.add(block)
1.48
1.49
1.50