changeset 12652:3c31c0e42b11

minirst: pull admonition titles out formatblock function
author Martin Geisler <mg@lazybytes.net>
date Fri, 08 Oct 2010 23:23:49 +0200
parents 17f28de168a4
children 5096faaa280e
files mercurial/minirst.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Fri Oct 08 23:19:26 2010 +0200
+++ b/mercurial/minirst.py	Fri Oct 08 23:23:49 2010 +0200
@@ -317,23 +317,23 @@
         i = i + 1
     return blocks
 
+_admonitiontitles = {'attention': _('Attention:'),
+                     'caution': _('Caution:'),
+                     'danger': _('!Danger!')  ,
+                     'error': _('Error:'),
+                     'hint': _('Hint:'),
+                     'important': _('Important:'),
+                     'note': _('Note:'),
+                     'tip': _('Tip:'),
+                     'warning': _('Warning!')}
+
 def formatblock(block, width):
     """Format a block according to width."""
     if width <= 0:
         width = 78
     indent = ' ' * block['indent']
     if block['type'] == 'admonition':
-        titles = {'attention': _('Attention:'),
-                  'caution': _('Caution:'),
-                  'danger': _('!Danger!')  ,
-                  'error': _('Error:'),
-                  'hint': _('Hint:'),
-                  'important': _('Important:'),
-                  'note': _('Note:'),
-                  'tip': _('Tip:'),
-                  'warning': _('Warning!')}
-
-        admonition = titles[block['admonitiontitle']]
+        admonition = _admonitiontitles[block['admonitiontitle']]
         hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
 
         defindent = indent + hang * ' '