Fix bug in ml classes where some tags were missed.

This commit is contained in:
John Schember 2009-05-26 17:41:46 -04:00
parent b92c2dc002
commit 1fd7c704d2
2 changed files with 47 additions and 45 deletions

View File

@ -98,11 +98,12 @@ class FB2MLizer(object):
return u''
tag = barename(elem.tag)
tag_count = 0
if tag == 'img':
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')
if fb2_tag and fb2_tag not in tag_stack:
tag_count += 1
@ -117,6 +118,7 @@ class FB2MLizer(object):
fb2_text += '<%s>' % style_tag
tag_stack.append(style_tag)
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
fb2_text += elem.text
for item in elem:

View File

@ -153,8 +153,6 @@ class PMLMLizer(object):
#if style['page-break-before'] == 'always':
# 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)
if pml_tag and pml_tag not in tag_stack:
tag_count += 1
@ -186,6 +184,8 @@ class PMLMLizer(object):
tag_stack.append(style_tag)
# 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)
for item in elem: