mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix bug in ml classes where some tags were missed.
This commit is contained in:
parent
b92c2dc002
commit
1fd7c704d2
@ -98,11 +98,12 @@ class FB2MLizer(object):
|
|||||||
return u''
|
return u''
|
||||||
|
|
||||||
tag = barename(elem.tag)
|
tag = barename(elem.tag)
|
||||||
|
tag_count = 0
|
||||||
|
|
||||||
if tag == 'img':
|
if tag == 'img':
|
||||||
fb2_text += '<image xlink:herf="#%s" />' % os.path.basename(elem.attrib['src'])
|
fb2_text += '<image xlink:herf="#%s" />' % os.path.basename(elem.attrib['src'])
|
||||||
|
|
||||||
tag_count = 0
|
|
||||||
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
|
||||||
fb2_tag = TAG_MAP.get(tag, 'p')
|
fb2_tag = TAG_MAP.get(tag, 'p')
|
||||||
if fb2_tag and fb2_tag not in tag_stack:
|
if fb2_tag and fb2_tag not in tag_stack:
|
||||||
tag_count += 1
|
tag_count += 1
|
||||||
@ -117,6 +118,7 @@ class FB2MLizer(object):
|
|||||||
fb2_text += '<%s>' % style_tag
|
fb2_text += '<%s>' % style_tag
|
||||||
tag_stack.append(style_tag)
|
tag_stack.append(style_tag)
|
||||||
|
|
||||||
|
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
||||||
fb2_text += elem.text
|
fb2_text += elem.text
|
||||||
|
|
||||||
for item in elem:
|
for item in elem:
|
||||||
|
@ -153,8 +153,6 @@ class PMLMLizer(object):
|
|||||||
#if style['page-break-before'] == 'always':
|
#if style['page-break-before'] == 'always':
|
||||||
# text += '\\p'
|
# text += '\\p'
|
||||||
|
|
||||||
# Proccess tags that contain text.
|
|
||||||
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
|
||||||
pml_tag = TAG_MAP.get(tag, None)
|
pml_tag = TAG_MAP.get(tag, None)
|
||||||
if pml_tag and pml_tag not in tag_stack:
|
if pml_tag and pml_tag not in tag_stack:
|
||||||
tag_count += 1
|
tag_count += 1
|
||||||
@ -186,6 +184,8 @@ class PMLMLizer(object):
|
|||||||
tag_stack.append(style_tag)
|
tag_stack.append(style_tag)
|
||||||
# margin
|
# margin
|
||||||
|
|
||||||
|
# Proccess tags that contain text.
|
||||||
|
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
||||||
text += self.elem_text(elem, tag_stack)
|
text += self.elem_text(elem, tag_stack)
|
||||||
|
|
||||||
for item in elem:
|
for item in elem:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user