[PATCH] minirst: modified minirst to also recognize empty comments

Erik Zielke ez at aragost.com
Tue Nov 16 06:29:25 CST 2010


# HG changeset patch
# User Erik Zielke <ez at aragost.com>
# Date 1289910548 -3600
# Node ID 3f93f3255a7e028a11094123e725356f8fa84477
# Parent  876a931dd2305758dd36ae30c5cd03ac4633db8e
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.

diff -r 876a931dd230 -r 3f93f3255a7e mercurial/minirst.py
--- a/mercurial/minirst.py	Tue Nov 16 11:10:50 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]
diff -r 876a931dd230 -r 3f93f3255a7e tests/test-minirst.py
--- a/tests/test-minirst.py	Tue Nov 16 11:10:50 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)
diff -r 876a931dd230 -r 3f93f3255a7e tests/test-minirst.py.out
--- a/tests/test-minirst.py.out	Tue Nov 16 11:10:50 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
 ----------------------------------------------------------------------
 


More information about the Mercurial-devel mailing list