mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 05:03:42 +02:00
Fix fb2 output.
This commit is contained in:
parent
7b121a42e3
commit
ee29a571f4
1 changed files with 3 additions and 4 deletions
|
|
@ -24,7 +24,7 @@
|
|||
'b' : 'strong',
|
||||
'i' : 'emphasis',
|
||||
'p' : 'p',
|
||||
'div' : 'p',
|
||||
'li' : 'p'
|
||||
}
|
||||
|
||||
STYLES = [
|
||||
|
|
@ -109,12 +109,13 @@ def dump_text(self, elem, stylizer, tag_stack=[]):
|
|||
fb2_text += '<image xlink:herf="#%s" />' % os.path.basename(elem.attrib['src'])
|
||||
|
||||
|
||||
fb2_tag = TAG_MAP.get(tag, 'p')
|
||||
fb2_tag = TAG_MAP.get(tag, None)
|
||||
if fb2_tag and fb2_tag not in tag_stack:
|
||||
tag_count += 1
|
||||
fb2_text += '<%s>' % fb2_tag
|
||||
tag_stack.append(fb2_tag)
|
||||
|
||||
|
||||
# Processes style information
|
||||
for s in STYLES:
|
||||
style_tag = s[1].get(style[s[0]], None)
|
||||
|
|
@ -132,7 +133,6 @@ def dump_text(self, elem, stylizer, tag_stack=[]):
|
|||
close_tag_list = []
|
||||
for i in range(0, tag_count):
|
||||
close_tag_list.insert(0, tag_stack.pop())
|
||||
|
||||
fb2_text += self.close_tags(close_tag_list)
|
||||
|
||||
if hasattr(elem, 'tail') and elem.tail != None and elem.tail.strip() != '':
|
||||
|
|
@ -150,4 +150,3 @@ def close_tags(self, tags):
|
|||
fb2_text += '</%s>' % fb2_tag
|
||||
|
||||
return fb2_text
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue