changeset 9738:f52c4f7a4732

minirst: prepare for general types of bullet lists The old code worked for '-' bullets only, but we can easily support variable width bullets.
author Martin Geisler <mg@lazybytes.net>
date Sat, 07 Nov 2009 03:04:46 +0100
parents 5f101af4a921
children 75cff8f12910
files mercurial/minirst.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Fri Nov 06 00:30:35 2009 +0100
+++ b/mercurial/minirst.py	Sat Nov 07 03:04:46 2009 +0100
@@ -94,9 +94,10 @@
             # correct for this here while we still have the original
             # information on the indentation of the subsequent literal
             # blocks available.
-            if blocks[i]['lines'][0].startswith('- '):
-                indent += 2
-                adjustment -= 2
+            m = _bulletre.match(blocks[i]['lines'][0])
+            if m:
+                indent += m.end()
+                adjustment -= m.end()
 
             # Mark the following indented blocks.
             while i+1 < len(blocks) and blocks[i+1]['indent'] > indent:
@@ -220,7 +221,9 @@
                                                subsequent_indent=defindent))
     initindent = subindent = indent
     if block['type'] == 'bullet':
-        subindent = indent + '  '
+        m = _bulletre.match(block['lines'][0])
+        if m:
+            subindent = indent + m.end() * ' '
     elif block['type'] == 'field':
         m = _fieldre.match(block['lines'][0])
         if m: