Skip to content
Snippets Groups Projects
Commit 876a931d authored by Martin Geisler's avatar Martin Geisler
Browse files

minirst: better interaction between comments and margins

You can now split a list with a comment:

  * foo

  .. separator

  * bar

and the two list items will no longer be run together, that is the
output is

  * foo

  * bar

instead of

  * foo
  * bar
parent 6747d4a5
No related branches found
No related tags found
No related merge requests found
......@@ -280,6 +280,8 @@
b = blocks[i]
if b['type'] == 'paragraph' and b['lines'][0].startswith('.. '):
del blocks[i]
if i < len(blocks) and blocks[i]['type'] == 'margin':
del blocks[i]
else:
i += 1
return blocks
......@@ -397,4 +399,5 @@
blocks = hgrole(blocks)
blocks = splitparagraphs(blocks)
blocks = updatefieldlists(blocks)
blocks = addmargins(blocks)
blocks = prunecomments(blocks)
......@@ -400,5 +403,4 @@
blocks = prunecomments(blocks)
blocks = addmargins(blocks)
blocks = findadmonitions(blocks)
text = '\n'.join(formatblock(b, width) for b in blocks)
if keep is None:
......@@ -425,4 +427,5 @@
blocks = debug(splitparagraphs, blocks)
blocks = debug(updatefieldlists, blocks)
blocks = debug(findsections, blocks)
blocks = debug(addmargins, blocks)
blocks = debug(prunecomments, blocks)
......@@ -428,4 +431,3 @@
blocks = debug(prunecomments, blocks)
blocks = debug(addmargins, blocks)
blocks = debug(findadmonitions, blocks)
print '\n'.join(formatblock(b, 30) for b in blocks)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment