Fix #3513 (conversion bug in Mobi 2 Epub)

This commit is contained in:
Kovid Goyal 2009-09-17 11:24:09 -06:00
parent 983e9bdb48
commit 842d7bed22

View File

@ -504,10 +504,20 @@ class MobiReader(object):
height = attrib.pop('height').strip()
if height and '<' not in height and '>' not in height and \
re.search(r'\d+', height):
if tag.tag in ('table', 'td', 'tr'):
pass
elif tag.tag == 'img':
tag.set('height', height)
else:
styles.append('margin-top: %s' % self.ensure_unit(height))
if attrib.has_key('width'):
width = attrib.pop('width').strip()
if width and re.search(r'\d+', width):
if tag.tag in ('table', 'td', 'tr'):
pass
elif tag.tag == 'img':
tag.set('width', width)
else:
styles.append('text-indent: %s' % self.ensure_unit(width))
if width.startswith('-'):
styles.append('margin-left: %s' % self.ensure_unit(width[1:]))