From dde3ae0416419bb31add1690d507adf3c04d0c98 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Jan 2019 09:28:34 +0530 Subject: [PATCH] Edit Book: Fix style attribute on tags not being preserved. Fixes #1810193 [ebook-edit drops STYLE attribute from HTML tags](https://bugs.launchpad.net/calibre/+bug/1810193) --- src/calibre/ebooks/mobi/writer8/skeleton.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/writer8/skeleton.py b/src/calibre/ebooks/mobi/writer8/skeleton.py index d6e4246d69..064a39d522 100644 --- a/src/calibre/ebooks/mobi/writer8/skeleton.py +++ b/src/calibre/ebooks/mobi/writer8/skeleton.py @@ -59,6 +59,7 @@ def node_from_path(root, path): parent = parent[idx] return parent + mychr = chr if ispy3 else unichr @@ -227,6 +228,8 @@ class Chunker(object): attrib = {'lang':lang} if lang else {} if 'class' in root.attrib: attrib['class'] = root.attrib['class'] + if 'style' in root.attrib: + attrib['style'] = root.attrib['style'] nroot = etree.Element('html', attrib=attrib) nroot.text = root.text nroot.tail = '\n' @@ -442,5 +445,3 @@ class Chunker(object): 'tool on the orig and rebuilt directories') else: self.log('Skeleton HTML before and after is identical.') - -