From bdb2a763d21774a2cdc28c23fc4ceef0bdc965db Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 Jul 2016 11:42:54 +0530 Subject: [PATCH] Old MOBI Output: Pass through percentage widths on
tags --- src/calibre/ebooks/mobi/mobiml.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 4ceec726f7..28ff90e30a 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -469,9 +469,12 @@ class MobiMLizer(object): istate.attrib['height'] = str(int(height)) item.unload_data_from_memory() elif tag == 'hr' and asfloat(style['width']) > 0 and style._get('width') not in {'100%', 'auto'}: - rawti = style._get('text-indent') - prop = style['width'] / self.profile.width - istate.attrib['width'] = "%d%%" % int(round(prop * 100)) + raww = style._get('width') + if hasattr(raww, 'strip') and '%' in raww: + istate.attrib['width'] = raww + else: + prop = style['width'] / self.profile.width + istate.attrib['width'] = "%d%%" % int(round(prop * 100)) elif display == 'table': tag = 'table' elif display == 'table-row':