1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-02-16 05:55:54 +01:00

Moved xml_replace_entities to utils.entities.

This commit is contained in:
2021-01-03 19:37:03 +01:00
parent dc4352fd4c
commit 8be21d878d
5 changed files with 13 additions and 16 deletions

View File

@@ -5,10 +5,10 @@ from lxml import etree
from lxml import html
from ebook_converter import constants as const
from ebook_converter import xml_replace_entities
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter.ebooks.chardet import xml_to_unicode, strip_encoding_declarations
from ebook_converter.utils import encoding as uenc
from ebook_converter.utils import entities
RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True,
@@ -208,9 +208,8 @@ def parse_html(data, log=None, decoder=None, preprocessor=None,
data = etree.fromstring(data)
check_for_html5(pre, data)
except (HTML5Doc, etree.XMLSyntaxError):
log.debug('Initial parse failed, using more'
' forgiving parsers')
raw = data = xml_replace_entities(raw)
log.debug('Initial parse failed, using more forgiving parsers')
raw = data = entities.xml_replace_entities(raw)
try:
data = etree.fromstring(data)
check_for_html5(pre, data)