Merge pull request #119 from BrenBarn/compact-lists

Fix problems that occurred when a list was the first thing in a section.
This commit is contained in:
Giuseppe Attardi 2017-03-08 12:10:04 +01:00 committed by GitHub
commit 2a5e6aebc0

View File

@ -2527,6 +2527,7 @@ def compact(text):
page.append(listClose[c])
listLevel = []
listCount = []
emptySection = False
elif page and page[-1]:
page.append('')
continue
@ -2591,10 +2592,11 @@ def compact(text):
line = line[i:].strip()
if line: # FIXME: n is '"'
if options.keepLists:
# emit open sections
items = sorted(headers.items())
for _, v in items:
page.append(v)
if options.keepSections:
# emit open sections
items = sorted(headers.items())
for _, v in items:
page.append(v)
headers.clear()
# use item count for #-lines
listCount[i - 1] += 1