From 00c6b21b747d35ac7aa0201c3c5d1e935bfe54ae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 14 May 2014 08:14:34 +0530 Subject: [PATCH] ... --- 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 395ff40910..6f8032e8f3 100644 --- a/src/calibre/ebooks/oeb/polish/pretty.py +++ b/src/calibre/ebooks/oeb/polish/pretty.py @@ -175,7 +175,8 @@ def pretty_html_tree(container, root): # Special case the handling of a body that contains a single block tag # 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': + 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): pretty_block(body[0], level=2) if container is not None: