##// END OF EJS Templates
minirst: pull admonition titles out formatblock function
Martin Geisler -
r12652:3c31c0e4 default
parent child Browse files
Show More
@@ -317,23 +317,23 b' def findadmonitions(blocks):'
317 i = i + 1
317 i = i + 1
318 return blocks
318 return blocks
319
319
320 _admonitiontitles = {'attention': _('Attention:'),
321 'caution': _('Caution:'),
322 'danger': _('!Danger!') ,
323 'error': _('Error:'),
324 'hint': _('Hint:'),
325 'important': _('Important:'),
326 'note': _('Note:'),
327 'tip': _('Tip:'),
328 'warning': _('Warning!')}
329
320 def formatblock(block, width):
330 def formatblock(block, width):
321 """Format a block according to width."""
331 """Format a block according to width."""
322 if width <= 0:
332 if width <= 0:
323 width = 78
333 width = 78
324 indent = ' ' * block['indent']
334 indent = ' ' * block['indent']
325 if block['type'] == 'admonition':
335 if block['type'] == 'admonition':
326 titles = {'attention': _('Attention:'),
336 admonition = _admonitiontitles[block['admonitiontitle']]
327 'caution': _('Caution:'),
328 'danger': _('!Danger!') ,
329 'error': _('Error:'),
330 'hint': _('Hint:'),
331 'important': _('Important:'),
332 'note': _('Note:'),
333 'tip': _('Tip:'),
334 'warning': _('Warning!')}
335
336 admonition = titles[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