Fixes bug with HTML conversion not reversible
This commit is contained in:
@@ -8,7 +8,7 @@ def convertHTML(source: str, sourceFrom: str):
|
||||
|
||||
if sourceFrom == "xml":
|
||||
xmldoc = etree.parse(BytesIO(source.encode("utf-8")), xmlParser)
|
||||
return html.tostring(xmldoc, method="html", pretty_print=True).decode()
|
||||
return html.tostring(xmldoc, method="html", pretty_print=True, doctype="<!DOCTYPE html>").decode()
|
||||
elif sourceFrom == "html":
|
||||
htmldoc = html.parse(BytesIO(source.encode("utf-8")), htmlParser)
|
||||
return etree.tostring(htmldoc, method="xml", pretty_print=True, doctype="", xml_declaration=True, encoding="utf-8").decode()
|
||||
|
||||
Reference in New Issue
Block a user