# HG changeset patch # User Martin Geisler # Date 1260740250 -3600 # Node ID 6f30c35766d6dd69fc7f9075c2dd099d832fae67 # Parent a46478b80ea3f946d061677f035a2a4d649e615d minirst: don't test regexps twice We know the regexps match since splitparagraphs used them too. diff -r a46478b80ea3 -r 6f30c35766d6 mercurial/minirst.py --- 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,