changeset 9735:97d0d910fa5d

minirst: remove unnecessary "elif:" statements
author Martin Geisler <mg@lazybytes.net>
date Thu, 05 Nov 2009 21:30:50 +0100
parents 36c388a1aa51
children 26d3ade60fa6
files mercurial/minirst.py
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Sat Nov 07 01:46:27 2009 +0100
+++ b/mercurial/minirst.py	Thu Nov 05 21:30:50 2009 +0100
@@ -291,30 +291,29 @@
     indent = ' ' * block['indent']
     if block['type'] == 'margin':
         return ''
-    elif block['type'] == 'literal':
+    if block['type'] == 'literal':
         indent += '  '
         return indent + ('\n' + indent).join(block['lines'])
-    elif block['type'] == 'section':
+    if block['type'] == 'section':
         return indent + ('\n' + indent).join(block['lines'])
-    elif block['type'] == 'definition':
+    if block['type'] == 'definition':
         term = indent + block['lines'][0]
         defindent = indent + block['hang'] * ' '
         text = ' '.join(map(str.strip, block['lines'][1:]))
         return "%s\n%s" % (term, textwrap.fill(text, width=width,
                                                initial_indent=defindent,
                                                subsequent_indent=defindent))
-    else:
-        initindent = subindent = indent
-        text = ' '.join(map(str.strip, block['lines']))
-        if block['type'] == 'bullet':
-            initindent = indent + '- '
-            subindent = indent + '  '
-        elif block['type'] in ('option', 'field'):
-            subindent = indent + block['width'] * ' '
+    initindent = subindent = indent
+    text = ' '.join(map(str.strip, block['lines']))
+    if block['type'] == 'bullet':
+        initindent = indent + '- '
+        subindent = indent + '  '
+    elif block['type'] in ('option', 'field'):
+        subindent = indent + block['width'] * ' '
 
-        return textwrap.fill(text, width=width,
-                             initial_indent=initindent,
-                             subsequent_indent=subindent)
+    return textwrap.fill(text, width=width,
+                         initial_indent=initindent,
+                         subsequent_indent=subindent)
 
 
 def format(text, width, indent=0):