changeset 15123:9b41ccb2043e

minirst: don't choke on empty text
author Matt Mackall <mpm@selenic.com>
date Sat, 17 Sep 2011 13:42:11 -0500
parents efa213b14ec0
children 8542a9c9f679
files mercurial/minirst.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Sat Sep 17 13:37:50 2011 -0500
+++ b/mercurial/minirst.py	Sat Sep 17 13:42:11 2011 -0500
@@ -38,9 +38,10 @@
     blocks = []
     for b in _blockre.split(text.lstrip('\n').rstrip()):
         lines = b.splitlines()
-        indent = min((len(l) - len(l.lstrip())) for l in lines)
-        lines = [l[indent:] for l in lines]
-        blocks.append(dict(indent=indent, lines=lines))
+        if lines:
+            indent = min((len(l) - len(l.lstrip())) for l in lines)
+            lines = [l[indent:] for l in lines]
+            blocks.append(dict(indent=indent, lines=lines))
     return blocks
 
 def findliteralblocks(blocks):