mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
fb2 output, style tail text properly.
This commit is contained in:
parent
f14a3a8601
commit
458e22a6ac
@ -116,17 +116,27 @@ class FB2MLizer(object):
|
|||||||
|
|
||||||
fb2_text += elem.text
|
fb2_text += elem.text
|
||||||
|
|
||||||
|
for item in elem:
|
||||||
|
fb2_text += self.dump_text(item, stylizer, tag_stack)
|
||||||
|
|
||||||
|
close_tags = []
|
||||||
|
for i in range(0, tag_count):
|
||||||
|
close_tags.insert(0, tag_stack.pop())
|
||||||
|
|
||||||
|
fb2_text += self.close_tags(close_tags)
|
||||||
|
|
||||||
if hasattr(elem, 'tail') and elem.tail != None and elem.tail.strip() != '':
|
if hasattr(elem, 'tail') and elem.tail != None and elem.tail.strip() != '':
|
||||||
if 'p' not in tag_stack:
|
if 'p' not in tag_stack:
|
||||||
fb2_text += '<p>%s</p>' % elem.tail
|
fb2_text += '<p>%s</p>' % elem.tail
|
||||||
else:
|
else:
|
||||||
fb2_text += elem.tail
|
fb2_text += elem.tail
|
||||||
|
|
||||||
for item in elem:
|
return fb2_text
|
||||||
fb2_text += self.dump_text(item, stylizer, tag_stack)
|
|
||||||
|
|
||||||
for i in range(0, tag_count):
|
def close_tags(self, tags):
|
||||||
fb2_tag = tag_stack.pop()
|
fb2_text = u''
|
||||||
|
for i in range(0, len(tags)):
|
||||||
|
fb2_tag = tags.pop()
|
||||||
fb2_text += '</%s>' % fb2_tag
|
fb2_text += '</%s>' % fb2_tag
|
||||||
|
|
||||||
return fb2_text
|
return fb2_text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user