1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-26 08:21:28 +02:00

Removing couple of "buildins" polyglot types

This commit is contained in:
2020-04-20 20:22:50 +02:00
parent eac0b98d6f
commit c867f0321b
36 changed files with 85 additions and 109 deletions
+3 -4
View File
@@ -1,5 +1,4 @@
import copy, os, re
from ebook_converter.polyglot.builtins import string_or_bytes
import urllib.parse
from ebook_converter.ebooks.oeb.base import barename, XPNSMAP, XPath, OPF, XHTML, OEB_DOCS
@@ -393,9 +392,9 @@ def merge_html(container, names, master, insert_page_breaks=False):
first_child = ''
for first_child in children:
if not isinstance(first_child, string_or_bytes):
if not isinstance(first_child, (str, bytes)):
break
if isinstance(first_child, string_or_bytes):
if isinstance(first_child, (str, bytes)):
# body contained only text, no tags
first_child = body.makeelement(XHTML('p'))
first_child.text, children[0] = children[0], first_child
@@ -431,7 +430,7 @@ def merge_html(container, names, master, insert_page_breaks=False):
a.set('href', '#' + amap[q])
for child in children:
if isinstance(child, string_or_bytes):
if isinstance(child, (str, bytes)):
add_text(master_body, child)
else:
master_body.append(copy.deepcopy(child))