mercurial/minirst.py
changeset 10984 68b7d2d668ce
parent 10983 287a5cdf7743
child 11189 3ef2572de32f
--- a/mercurial/minirst.py	Sun Apr 25 17:48:26 2010 +0200
+++ b/mercurial/minirst.py	Sun Apr 25 18:19:54 2010 +0200
@@ -225,6 +225,8 @@
     return blocks, pruned
 
 
+_sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
+
 def findsections(blocks):
     """Finds sections.
 
@@ -240,7 +242,8 @@
         # +------------------------------+
         if (block['type'] == 'paragraph' and
             len(block['lines']) == 2 and
-            block['lines'][1] == '-' * len(block['lines'][0])):
+            len(block['lines'][0]) == len(block['lines'][1]) and
+            _sectionre.match(block['lines'][1])):
             block['underline'] = block['lines'][1][0]
             block['type'] = 'section'
             del block['lines'][1]