##// 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 226 initindent = subindent = indent
227 227 if block['type'] == 'bullet':
228 228 m = _bulletre.match(block['lines'][0])
229 if m:
230 subindent = indent + m.end() * ' '
229 subindent = indent + m.end() * ' '
231 230 elif block['type'] == 'field':
232 231 m = _fieldre.match(block['lines'][0])
233 if m:
234 key, spaces, rest = m.groups()
235 # Turn ":foo: bar" into "foo bar".
236 block['lines'][0] = '%s %s%s' % (key, spaces, rest)
237 subindent = indent + (2 + len(key) + len(spaces)) * ' '
232 key, spaces, rest = m.groups()
233 # Turn ":foo: bar" into "foo bar".
234 block['lines'][0] = '%s %s%s' % (key, spaces, rest)
235 subindent = indent + (2 + len(key) + len(spaces)) * ' '
238 236 elif block['type'] == 'option':
239 237 m = _optionre.match(block['lines'][0])
240 if m:
241 option, arg, rest = m.groups()
242 subindent = indent + (len(option) + len(arg)) * ' '
238 option, arg, rest = m.groups()
239 subindent = indent + (len(option) + len(arg)) * ' '
243 240
244 241 text = ' '.join(map(str.strip, block['lines']))
245 242 return textwrap.fill(text, width=width,
General Comments 0
You need to be logged in to leave comments. Login now