From 2e91a7cde62ff6a68692effd0ea00ebd16e0a764 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 12 Jan 2012 13:34:29 +0530 Subject: [PATCH] MOBI Output: When converting a paragraph that contains only a non-breaking space into a line break, ignore paragraphs with height less than 2pt. Fixes #915150 (Mobi file to mobi file conversin inserting blank line between every paragraph, even when selecting "Remove spacing between paragraphs") --- src/calibre/ebooks/mobi/mobiml.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 479afa3d06..7cda4b0a57 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -568,7 +568,11 @@ class MobiMLizer(object): if isblock: para = bstate.para if para is not None and para.text == u'\xa0' and len(para) < 1: - para.getparent().replace(para, etree.Element(XHTML('br'))) + if style.height > 2: + para.getparent().replace(para, etree.Element(XHTML('br'))) + else: + # This is too small to be rendered effectively, drop it + para.getparent().remove(para) bstate.para = None bstate.istate = None vmargin = asfloat(style['margin-bottom'])