##// END OF EJS Templates
minirst: don't test regexps twice...
Martin Geisler -
r10064:6f30c357 default
parent child Browse files
Show More
@@ -226,20 +226,17 b' def formatblock(block, width):'
226 initindent = subindent = indent
226 initindent = subindent = indent
227 if block['type'] == 'bullet':
227 if block['type'] == 'bullet':
228 m = _bulletre.match(block['lines'][0])
228 m = _bulletre.match(block['lines'][0])
229 if m:
229 subindent = indent + m.end() * ' '
230 subindent = indent + m.end() * ' '
231 elif block['type'] == 'field':
230 elif block['type'] == 'field':
232 m = _fieldre.match(block['lines'][0])
231 m = _fieldre.match(block['lines'][0])
233 if m:
232 key, spaces, rest = m.groups()
234 key, spaces, rest = m.groups()
233 # Turn ":foo: bar" into "foo bar".
235 # Turn ":foo: bar" into "foo bar".
234 block['lines'][0] = '%s %s%s' % (key, spaces, rest)
236 block['lines'][0] = '%s %s%s' % (key, spaces, rest)
235 subindent = indent + (2 + len(key) + len(spaces)) * ' '
237 subindent = indent + (2 + len(key) + len(spaces)) * ' '
238 elif block['type'] == 'option':
236 elif block['type'] == 'option':
239 m = _optionre.match(block['lines'][0])
237 m = _optionre.match(block['lines'][0])
240 if m:
238 option, arg, rest = m.groups()
241 option, arg, rest = m.groups()
239 subindent = indent + (len(option) + len(arg)) * ' '
242 subindent = indent + (len(option) + len(arg)) * ' '
243
240
244 text = ' '.join(map(str.strip, block['lines']))
241 text = ' '.join(map(str.strip, block['lines']))
245 return textwrap.fill(text, width=width,
242 return textwrap.fill(text, width=width,
General Comments 0
You need to be logged in to leave comments. Login now