Fix problems that occurred when a list was the first thing in a section.

There were bugs that caused content to be dropped or erroneously included if a list was the first thing in a section and --lists was specified.  This change should fix #117 and #118.
This commit is contained in:
BrenBarn 2017-03-08 01:01:31 -08:00
parent 05cbe1502d
commit 674e9a0264

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