minirst: pull admonition titles out formatblock function
authorMartin Geisler <mg@lazybytes.net>
Fri, 08 Oct 2010 23:23:49 +0200
changeset 12652 3c31c0e42b11
parent 12651 17f28de168a4
child 12653 5096faaa280e
minirst: pull admonition titles out formatblock function
mercurial/minirst.py
--- 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 * ' '