changeset 13003:876a931dd230

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
author Martin Geisler <mg@aragost.com>
date Tue, 16 Nov 2010 11:10:50 +0100
parents 6747d4a5c45d
children efbee27415ab
files mercurial/minirst.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Tue Nov 16 10:33:19 2010 +0900
+++ b/mercurial/minirst.py	Tue Nov 16 11:10:50 2010 +0100
@@ -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,8 +399,8 @@
     blocks = hgrole(blocks)
     blocks = splitparagraphs(blocks)
     blocks = updatefieldlists(blocks)
+    blocks = addmargins(blocks)
     blocks = prunecomments(blocks)
-    blocks = addmargins(blocks)
     blocks = findadmonitions(blocks)
     text = '\n'.join(formatblock(b, width) for b in blocks)
     if keep is None:
@@ -425,7 +427,7 @@
     blocks = debug(splitparagraphs, blocks)
     blocks = debug(updatefieldlists, blocks)
     blocks = debug(findsections, blocks)
+    blocks = debug(addmargins, blocks)
     blocks = debug(prunecomments, blocks)
-    blocks = debug(addmargins, blocks)
     blocks = debug(findadmonitions, blocks)
     print '\n'.join(formatblock(b, 30) for b in blocks)