Fix bug #3941: Handle input with <br> separated paragraphs better.

This commit is contained in:
John Schember 2009-11-13 11:41:09 -05:00
parent 155fd8a9e6
commit c2d9b2e6ad

View File

@ -30,7 +30,7 @@ TAG_MAP = {
'i' : 'emphasis',
'p' : 'p',
'li' : 'p',
'br' : 'empty-line',
'br' : 'p',
}
TAG_SPACE = [
@ -227,8 +227,14 @@ class FB2MLizer(object):
fb2_text.append(self.get_anchor(page, id_name))
fb2_tag = TAG_MAP.get(tag, None)
if fb2_tag and fb2_tag not in tag_stack:
if fb2_tag:
if fb2_tag not in tag_stack:
tag_count += 1
else:
tag_stack.reverse()
tag_stack.remove(fb2_tag)
tag_stack.reverse()
fb2_text.append('</%s>' % fb2_tag)
fb2_text.append('<%s>' % fb2_tag)
tag_stack.append(fb2_tag)