From e9f82abf392d749b91d5fda8f20b02f444b6ec60 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 10 Aug 2017 10:54:09 +0530 Subject: [PATCH] DOCX Input: Fix framed lists being rendered with the frame inside the bullets instead of outside it. Fixes #1709569 [Converting from DOCX - problem with framed paragraphs and lists](https://bugs.launchpad.net/calibre/+bug/1709569) --- src/calibre/ebooks/docx/to_html.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/docx/to_html.py b/src/calibre/ebooks/docx/to_html.py index 62780e3644..6673a76438 100644 --- a/src/calibre/ebooks/docx/to_html.py +++ b/src/calibre/ebooks/docx/to_html.py @@ -724,8 +724,14 @@ class Convert(object): for border_style, blocks in self.block_runs: paras = tuple(rmap[p] for p in blocks) parent = paras[0].getparent() - idx = parent.index(paras[0]) - frame = DIV(*paras) + if parent.tag in ('ul', 'ol'): + ul = parent + parent = ul.getparent() + idx = parent.index(ul) + frame = DIV(ul) + else: + idx = parent.index(paras[0]) + frame = DIV(*paras) parent.insert(idx, frame) self.framed_map[frame] = css = border_style.css self.styles.register(css, 'frame')