From 8601b461510f8148094f90f98637270631266086 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 23 Feb 2018 08:29:51 +0530 Subject: [PATCH] Conversion: Handle the deprecated type attribute on
    tags. Fixes #1751148 [Bad conversion
      from ePub to azw3](https://bugs.launchpad.net/calibre/+bug/1751148) --- resources/templates/html.css | 16 ++++++++++++++++ src/calibre/ebooks/oeb/transforms/flatcss.py | 2 ++ 2 files changed, 18 insertions(+) diff --git a/resources/templates/html.css b/resources/templates/html.css index cbf615e524..cf04ea3f4a 100644 --- a/resources/templates/html.css +++ b/resources/templates/html.css @@ -303,6 +303,22 @@ ol { margin: 1em 0; } +ol[type="a"] { + list-style-type: lower-alpha; +} + +ol[type="A"] { + list-style-type: upper-alpha; +} + +ol[type="i"] { + list-style-type: lower-roman; +} + +ol[type="I"] { + list-style-type: upper-roman; +} + li { display: list-item; } diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index e4d3937df9..5f8443aa5e 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -430,6 +430,8 @@ class CSSFlattener(object): except (ValueError, SyntaxErr): pass del node.attrib['bgcolor'] + if tag == 'ol' and 'type' in node.attrib: + del node.attrib['type'] if cssdict.get('font-weight', '').lower() == 'medium': cssdict['font-weight'] = 'normal' # ADE chokes on font-weight medium