From e609bd600338a98c6c4b9f05cd824ee6dbe19172 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 13 Feb 2011 18:43:05 -0700 Subject: [PATCH] MOBI Output: Partially support CSS vertical-align length values, converting them to or tags --- src/calibre/ebooks/mobi/mobiml.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index bdf81597b1..22ee97eff2 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -454,8 +454,10 @@ class MobiMLizer(object): text = COLLAPSE.sub(' ', elem.text) valign = style['vertical-align'] not_baseline = valign in ('super', 'sub', 'text-top', - 'text-bottom') - vtag = 'sup' if valign in ('super', 'text-top') else 'sub' + 'text-bottom') or isinstance(valign, (float, int)) + issup = valign in ('super', 'text-top') or ( + isinstance(valign, (float, int)) and valign > 0) + vtag = 'sup' if issup else 'sub' if not_baseline and not ignore_valign and tag not in NOT_VTAGS and not isblock: nroot = etree.Element(XHTML('html'), nsmap=MOBI_NSMAP) vbstate = BlockState(etree.SubElement(nroot, XHTML('body')))