From deb333ef053529e18f0c791adb822da357b5af1b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 9 Feb 2016 17:03:31 +0530 Subject: [PATCH] Edit Book Beautify: Do not beautify the insides of heading tags even when they are the only child of body --- src/calibre/ebooks/oeb/polish/pretty.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/pretty.py b/src/calibre/ebooks/oeb/polish/pretty.py index f8a0b4fc8b..02c1ce987a 100644 --- a/src/calibre/ebooks/oeb/polish/pretty.py +++ b/src/calibre/ebooks/oeb/polish/pretty.py @@ -176,7 +176,8 @@ def pretty_html_tree(container, root): # with all content. In this case we prettify the containing block tag # even if it has non block children. if (len(body) == 1 and not callable(body[0].tag) and isblock(body[0]) and - not has_only_blocks(body[0]) and barename(body[0].tag) != 'pre' and len(body[0]) > 0): + not has_only_blocks(body[0]) and barename(body[0].tag) not in ( + 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6') and len(body[0]) > 0): pretty_block(body[0], level=2) if container is not None: