1.1 --- a/moinformat.py Thu Apr 27 23:02:45 2017 +0200
1.2 +++ b/moinformat.py Thu Apr 27 23:15:30 2017 +0200
1.3 @@ -356,11 +356,7 @@
1.4 # Start a section if an appropriate marker is given.
1.5
1.6 if items.matching == "regionstart":
1.7 -
1.8 - # Parse the section and start a new block after the section.
1.9 -
1.10 - region.append(parse_region(items, len(feature)))
1.11 - block = new_block(region)
1.12 + block = parse_region_within_wiki_region(items, region)
1.13
1.14 # Interpret the given marker, closing the current section if the
1.15 # given marker is the corresponding end marker for the current
1.16 @@ -372,8 +368,7 @@
1.17 # Start a new block if a paragraph break is found.
1.18
1.19 elif items.matching == "break":
1.20 - block.final = False
1.21 - block = new_block(region)
1.22 + block = parse_block(items, region)
1.23
1.24 # Add any inappropriate marker to the text.
1.25
1.26 @@ -382,6 +377,22 @@
1.27
1.28 region.normalise()
1.29
1.30 +def parse_region_within_wiki_region(items, region):
1.31 +
1.32 + # Parse the section and start a new block after the section.
1.33 +
1.34 + feature = items.read_match()
1.35 + region.append(parse_region(items, len(feature)))
1.36 + return new_block(region)
1.37 +
1.38 +def parse_block(items, region):
1.39 +
1.40 + # Mark any previous block as not being the final one in a sequence.
1.41 +
1.42 + block = region.nodes[-1]
1.43 + block.final = False
1.44 + return new_block(region)
1.45 +
1.46 def parse_region_opaque(items, region):
1.47
1.48 "Parse the data provided by 'items' to populate an opaque 'region'."