mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Out: Fix regression causing missing v-margins
MOBI Output: Fix regression in 0.9.31 that caused vertical margins specified on some block level elements to be ignored. Fixes #1186533 [Regression: some margins lost when converting to MOBI](https://bugs.launchpad.net/calibre/+bug/1186533)
This commit is contained in:
parent
b24493d7e8
commit
756fa6d32a
@ -20,7 +20,7 @@ def MBP(name):
|
|||||||
return '{%s}%s' % (MBP_NS, name)
|
return '{%s}%s' % (MBP_NS, name)
|
||||||
|
|
||||||
MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS}
|
MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS}
|
||||||
|
INLINE_TAGS = {'span', 'a', 'code', 'u', 's', 'big', 'strike', 'tt', 'font', 'q', 'i', 'b', 'em', 'strong', 'sup', 'sub'}
|
||||||
HEADER_TAGS = set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
|
HEADER_TAGS = set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
|
||||||
# GR: Added 'caption' to both sets
|
# GR: Added 'caption' to both sets
|
||||||
NESTABLE_TAGS = set(['ol', 'ul', 'li', 'table', 'tr', 'td', 'th', 'caption'])
|
NESTABLE_TAGS = set(['ol', 'ul', 'li', 'table', 'tr', 'td', 'th', 'caption'])
|
||||||
@ -489,6 +489,9 @@ class MobiMLizer(object):
|
|||||||
if elem.text:
|
if elem.text:
|
||||||
if istate.preserve:
|
if istate.preserve:
|
||||||
text = elem.text
|
text = elem.text
|
||||||
|
elif (len(elem) > 0 and isspace(elem.text) and elem[0].tag and
|
||||||
|
elem[0].tag.rpartition('}')[-1] not in INLINE_TAGS):
|
||||||
|
text = None
|
||||||
else:
|
else:
|
||||||
text = COLLAPSE.sub(' ', elem.text)
|
text = COLLAPSE.sub(' ', elem.text)
|
||||||
valign = style['vertical-align']
|
valign = style['vertical-align']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user