minirst: don't test regexps twice
We know the regexps match since splitparagraphs used them too.
--- a/mercurial/minirst.py Sun Dec 13 19:24:24 2009 +0100
+++ b/mercurial/minirst.py Sun Dec 13 22:37:30 2009 +0100
@@ -226,20 +226,17 @@
initindent = subindent = indent
if block['type'] == 'bullet':
m = _bulletre.match(block['lines'][0])
- if m:
- subindent = indent + m.end() * ' '
+ subindent = indent + m.end() * ' '
elif block['type'] == 'field':
m = _fieldre.match(block['lines'][0])
- if m:
- key, spaces, rest = m.groups()
- # Turn ":foo: bar" into "foo bar".
- block['lines'][0] = '%s %s%s' % (key, spaces, rest)
- subindent = indent + (2 + len(key) + len(spaces)) * ' '
+ key, spaces, rest = m.groups()
+ # Turn ":foo: bar" into "foo bar".
+ block['lines'][0] = '%s %s%s' % (key, spaces, rest)
+ subindent = indent + (2 + len(key) + len(spaces)) * ' '
elif block['type'] == 'option':
m = _optionre.match(block['lines'][0])
- if m:
- option, arg, rest = m.groups()
- subindent = indent + (len(option) + len(arg)) * ' '
+ option, arg, rest = m.groups()
+ subindent = indent + (len(option) + len(arg)) * ' '
text = ' '.join(map(str.strip, block['lines']))
return textwrap.fill(text, width=width,