Edit Book: Fix error when merging an empty HTML document or one that contains only text and no tags. Fixes #1535427 [Edit ebook, merge selected text files fail.](https://bugs.launchpad.net/calibre/+bug/1535427)

This commit is contained in:
Kovid Goyal 2016-01-20 00:17:36 +05:30
parent 78fcc5cd6c
commit 15aadb14c4

View File

@ -377,8 +377,9 @@ def merge_html(container, names, master):
if not isinstance(first_child, basestring): if not isinstance(first_child, basestring):
break break
if isinstance(first_child, basestring): if isinstance(first_child, basestring):
# Empty document, ignore # body contained only text, no tags
continue first_child = body.makeelement(XHTML('p'))
first_child.text, children[0] = children[0], first_child
amap = anchor_map[name] amap = anchor_map[name]
remove_name_attributes(root) remove_name_attributes(root)