mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Improve Mobipocket conversion of basic tables
This commit is contained in:
parent
48340fe6ef
commit
c198458f65
@ -140,7 +140,7 @@ class MobiMLizer(object):
|
||||
para = bstate.para
|
||||
if tag in SPECIAL_TAGS and not text:
|
||||
para = para if para is not None else bstate.body
|
||||
elif para is None:
|
||||
elif para is None or tag in ('td', 'th'):
|
||||
body = bstate.body
|
||||
if bstate.pbreak:
|
||||
etree.SubElement(body, MBP('pagebreak'))
|
||||
@ -160,7 +160,8 @@ class MobiMLizer(object):
|
||||
elif indent != 0 and abs(indent) < self.profile.fbase:
|
||||
indent = (indent / abs(indent)) * self.profile.fbase
|
||||
if tag in NESTABLE_TAGS:
|
||||
para = wrapper = etree.SubElement(parent, XHTML(tag))
|
||||
para = wrapper = etree.SubElement(
|
||||
parent, XHTML(tag), attrib=istate.attrib)
|
||||
bstate.nested.append(para)
|
||||
if tag == 'li' and len(istates) > 1:
|
||||
istates[-2].list_num += 1
|
||||
@ -340,6 +341,10 @@ class MobiMLizer(object):
|
||||
tag = 'tr'
|
||||
elif display == 'table-cell':
|
||||
tag = 'td'
|
||||
if tag in TABLE_TAGS:
|
||||
for attr in ('rowspan', 'colspan'):
|
||||
if attr in elem.attrib:
|
||||
istate.attrib[attr] = elem.attrib[attr]
|
||||
text = None
|
||||
if elem.text:
|
||||
if istate.preserve:
|
||||
@ -377,6 +382,6 @@ class MobiMLizer(object):
|
||||
bstate.vpadding += bstate.vmargin
|
||||
bstate.vmargin = 0
|
||||
bstate.vpadding += vpadding
|
||||
if tag in NESTABLE_TAGS and bstate.nested:
|
||||
if bstate.nested and bstate.nested[-1].tag == elem.tag:
|
||||
bstate.nested.pop()
|
||||
istates.pop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user