From 1c225cac666e28563e6a99f720f35b1cd31c18f7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 May 2013 21:51:12 +0530 Subject: [PATCH] MOBI Output: Fix space errorneously being removed when the input document contains a tag with leading space and sub-tags. Fixes #1179216 (Space lost between span tags converting to mobi) --- src/calibre/ebooks/mobi/mobiml.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 9610b7c0bd..f6cd55dafe 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -16,7 +16,8 @@ from calibre.ebooks.oeb.transforms.flatcss import KeyMapper from calibre.utils.magick.draw import identify_data MBP_NS = 'http://mobipocket.com/ns/mbp' -def MBP(name): return '{%s}%s' % (MBP_NS, name) +def MBP(name): + return '{%s}%s' % (MBP_NS, name) MOBI_NSMAP = {None: XHTML_NS, 'mbp': MBP_NS} @@ -413,7 +414,7 @@ class MobiMLizer(object): # img sizes in units other than px # See #7520 for test case try: - pixs = int(round(float(value) / \ + pixs = int(round(float(value) / (72./self.profile.dpi))) except: continue @@ -488,8 +489,6 @@ class MobiMLizer(object): if elem.text: if istate.preserve: text = elem.text - elif len(elem) > 0 and isspace(elem.text): - text = None else: text = COLLAPSE.sub(' ', elem.text) valign = style['vertical-align']