1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-03-03 07:15:53 +01:00

Moved xml_entity_to_unicode partial to utils.entities module.

This commit is contained in:
2021-01-03 19:00:17 +01:00
parent 839cc3c79a
commit 877ea68d42
4 changed files with 13 additions and 22 deletions

View File

@@ -27,12 +27,6 @@ class CurrentDir(object):
_ent_pat = re.compile(r'&(\S+?);')
xml_entity_to_unicode = partial(entities.entity_to_unicode,
result_exceptions={'"': '"',
"'": ''',
'<': '&lt;',
'>': '&gt;',
'&': '&amp;'})
def replace_entities(raw, encoding='cp1252'):
@@ -41,7 +35,8 @@ def replace_entities(raw, encoding='cp1252'):
def xml_replace_entities(raw, encoding='cp1252'):
return _ent_pat.sub(partial(xml_entity_to_unicode, encoding=encoding), raw)
return _ent_pat.sub(partial(entities.xml_entity_to_unicode,
encoding=encoding), raw)
def prepare_string_for_xml(raw, attribute=False):