1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-02-15 21:45:52 +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

@@ -29,11 +29,6 @@ class CurrentDir(object):
_ent_pat = re.compile(r'&(\S+?);')
def xml_replace_entities(raw, encoding='cp1252'):
return _ent_pat.sub(partial(entities.xml_entity_to_unicode,
encoding=encoding), raw)
def prepare_string_for_xml(raw, attribute=False):
raw = _ent_pat.sub(entities.entity_to_unicode, raw)
raw = raw.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')