mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
minirst: don't choke on empty text
This commit is contained in:
parent
5195ef177c
commit
35cdad6929
@ -38,9 +38,10 @@ def findblocks(text):
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user