mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Output:Improved handling of tables
This commit is contained in:
parent
884b8da3a6
commit
0df9e9bd9d
@ -20,8 +20,10 @@ def MBP(name): return '{%s}%s' % (MBP_NS, name)
|
|||||||
MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS}
|
MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS}
|
||||||
|
|
||||||
HEADER_TAGS = set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
|
HEADER_TAGS = set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
|
||||||
NESTABLE_TAGS = set(['ol', 'ul', 'li', 'table', 'tr', 'td', 'th'])
|
# GR: Added 'caption' to both sets
|
||||||
TABLE_TAGS = set(['table', 'tr', 'td', 'th'])
|
NESTABLE_TAGS = set(['ol', 'ul', 'li', 'table', 'tr', 'td', 'th', 'caption'])
|
||||||
|
TABLE_TAGS = set(['table', 'tr', 'td', 'th', 'caption'])
|
||||||
|
|
||||||
SPECIAL_TAGS = set(['hr', 'br'])
|
SPECIAL_TAGS = set(['hr', 'br'])
|
||||||
CONTENT_TAGS = set(['img', 'hr', 'br'])
|
CONTENT_TAGS = set(['img', 'hr', 'br'])
|
||||||
|
|
||||||
@ -357,8 +359,10 @@ class MobiMLizer(object):
|
|||||||
tag = 'td'
|
tag = 'td'
|
||||||
if tag in TABLE_TAGS and self.ignore_tables:
|
if tag in TABLE_TAGS and self.ignore_tables:
|
||||||
tag = 'span' if tag == 'td' else 'div'
|
tag = 'span' if tag == 'td' else 'div'
|
||||||
|
|
||||||
|
# GR: Added 'width', 'border' and 'scope'
|
||||||
if tag in TABLE_TAGS:
|
if tag in TABLE_TAGS:
|
||||||
for attr in ('rowspan', 'colspan'):
|
for attr in ('rowspan', 'colspan','width','border','scope'):
|
||||||
if attr in elem.attrib:
|
if attr in elem.attrib:
|
||||||
istate.attrib[attr] = elem.attrib[attr]
|
istate.attrib[attr] = elem.attrib[attr]
|
||||||
text = None
|
text = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user