##// END OF EJS Templates
minirst: remove unnecessary "elif:" statements
Martin Geisler -
r9735:97d0d910 default
parent child Browse files
Show More
@@ -291,30 +291,29 b' def formatblock(block, width):'
291 indent = ' ' * block['indent']
291 indent = ' ' * block['indent']
292 if block['type'] == 'margin':
292 if block['type'] == 'margin':
293 return ''
293 return ''
294 elif block['type'] == 'literal':
294 if block['type'] == 'literal':
295 indent += ' '
295 indent += ' '
296 return indent + ('\n' + indent).join(block['lines'])
296 return indent + ('\n' + indent).join(block['lines'])
297 elif block['type'] == 'section':
297 if block['type'] == 'section':
298 return indent + ('\n' + indent).join(block['lines'])
298 return indent + ('\n' + indent).join(block['lines'])
299 elif block['type'] == 'definition':
299 if block['type'] == 'definition':
300 term = indent + block['lines'][0]
300 term = indent + block['lines'][0]
301 defindent = indent + block['hang'] * ' '
301 defindent = indent + block['hang'] * ' '
302 text = ' '.join(map(str.strip, block['lines'][1:]))
302 text = ' '.join(map(str.strip, block['lines'][1:]))
303 return "%s\n%s" % (term, textwrap.fill(text, width=width,
303 return "%s\n%s" % (term, textwrap.fill(text, width=width,
304 initial_indent=defindent,
304 initial_indent=defindent,
305 subsequent_indent=defindent))
305 subsequent_indent=defindent))
306 else:
306 initindent = subindent = indent
307 initindent = subindent = indent
307 text = ' '.join(map(str.strip, block['lines']))
308 text = ' '.join(map(str.strip, block['lines']))
308 if block['type'] == 'bullet':
309 if block['type'] == 'bullet':
309 initindent = indent + '- '
310 initindent = indent + '- '
310 subindent = indent + ' '
311 subindent = indent + ' '
311 elif block['type'] in ('option', 'field'):
312 elif block['type'] in ('option', 'field'):
312 subindent = indent + block['width'] * ' '
313 subindent = indent + block['width'] * ' '
314
313
315 return textwrap.fill(text, width=width,
314 return textwrap.fill(text, width=width,
316 initial_indent=initindent,
315 initial_indent=initindent,
317 subsequent_indent=subindent)
316 subsequent_indent=subindent)
318
317
319
318
320 def format(text, width, indent=0):
319 def format(text, width, indent=0):
General Comments 0
You need to be logged in to leave comments. Login now