From ca50102cc5e7723ea18bc6649a0eab6ba934b1b7 Mon Sep 17 00:00:00 2001 From: widlam Date: Mon, 7 Aug 2023 13:38:32 +0200 Subject: [PATCH] Fixes bug with HTML conversion not reversible --- Backend-libXML/Parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Backend-libXML/Parser.py b/Backend-libXML/Parser.py index 0357cd8..442484d 100644 --- a/Backend-libXML/Parser.py +++ b/Backend-libXML/Parser.py @@ -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="").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()