minirst: modified minirst to also recognize empty comments.
authorErik Zielke <ez@aragost.com>
Tue, 16 Nov 2010 13:29:08 +0100
changeset 13009 54be08fa4d1d
parent 13008 ac627ab0b3a5
child 13010 6bdae8ea0b48
minirst: modified minirst to also recognize empty comments. The modifies minirst to also handle empty comments. An empty comment is a block with a single line containing two dots.
mercurial/minirst.py
tests/test-minirst.py
tests/test-minirst.py.out
--- a/mercurial/minirst.py	Wed Nov 17 09:17:55 2010 +0100
+++ b/mercurial/minirst.py	Tue Nov 16 13:29:08 2010 +0100
@@ -278,7 +278,8 @@
     i = 0
     while i < len(blocks):
         b = blocks[i]
-        if b['type'] == 'paragraph' and b['lines'][0].startswith('.. '):
+        if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
+                                         b['lines'] == ['..']):
             del blocks[i]
             if i < len(blocks) and blocks[i]['type'] == 'margin':
                 del blocks[i]
--- a/tests/test-minirst.py	Wed Nov 17 09:17:55 2010 +0100
+++ b/tests/test-minirst.py	Tue Nov 16 13:29:08 2010 +0100
@@ -221,6 +221,10 @@
    .. An indented comment
 
    Some indented text.
+
+..
+
+Empty comment above
 """
 
 debugformat('comments', comments, 30)
--- a/tests/test-minirst.py.out	Wed Nov 17 09:17:55 2010 +0100
+++ b/tests/test-minirst.py.out	Tue Nov 16 13:29:08 2010 +0100
@@ -339,5 +339,7 @@
 Some text.
 
    Some indented text.
+
+Empty comment above
 ----------------------------------------------------------------------