# HG changeset patch # User Martin Geisler # Date 1257559486 -3600 # Node ID f52c4f7a4732e046500eeb9cf80819a911fae4e6 # Parent 5f101af4a92130266de9598022fcccc34b0ed79a minirst: prepare for general types of bullet lists The old code worked for '-' bullets only, but we can easily support variable width bullets. diff -r 5f101af4a921 -r f52c4f7a4732 mercurial/minirst.py --- 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: