From 756fa6d32af62597bfc8a233db40c68a61b8baa8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Jun 2013 22:11:06 +0530 Subject: [PATCH] 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) --- src/calibre/ebooks/mobi/mobiml.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index f6cd55dafe..0bb66ec843 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -20,7 +20,7 @@ def MBP(name): return '{%s}%s' % (MBP_NS, name) 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']) # GR: Added 'caption' to both sets NESTABLE_TAGS = set(['ol', 'ul', 'li', 'table', 'tr', 'td', 'th', 'caption']) @@ -489,6 +489,9 @@ class MobiMLizer(object): if elem.text: if istate.preserve: 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: text = COLLAPSE.sub(' ', elem.text) valign = style['vertical-align']