##// END OF EJS Templates
minirst: pull admonition titles out formatblock function
Martin Geisler -
r12652:3c31c0e4 default
parent child Browse files
Show More
@@ -317,13 +317,7 b' def findadmonitions(blocks):'
317 i = i + 1
317 i = i + 1
318 return blocks
318 return blocks
319
319
320 def formatblock(block, width):
320 _admonitiontitles = {'attention': _('Attention:'),
321 """Format a block according to width."""
322 if width <= 0:
323 width = 78
324 indent = ' ' * block['indent']
325 if block['type'] == 'admonition':
326 titles = {'attention': _('Attention:'),
327 'caution': _('Caution:'),
321 'caution': _('Caution:'),
328 'danger': _('!Danger!') ,
322 'danger': _('!Danger!') ,
329 'error': _('Error:'),
323 'error': _('Error:'),
@@ -333,7 +327,13 b' def formatblock(block, width):'
333 'tip': _('Tip:'),
327 'tip': _('Tip:'),
334 'warning': _('Warning!')}
328 'warning': _('Warning!')}
335
329
336 admonition = titles[block['admonitiontitle']]
330 def formatblock(block, width):
331 """Format a block according to width."""
332 if width <= 0:
333 width = 78
334 indent = ' ' * block['indent']
335 if block['type'] == 'admonition':
336 admonition = _admonitiontitles[block['admonitiontitle']]
337 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
337 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
338
338
339 defindent = indent + hang * ' '
339 defindent = indent + hang * ' '
General Comments 0
You need to be logged in to leave comments. Login now