Made formatter more reliable
This commit is contained in:
@@ -14,7 +14,9 @@ def prettify(source: str) -> str:
|
|||||||
prolog_end = source.find("?>") + 2
|
prolog_end = source.find("?>") + 2
|
||||||
prolog = source[prolog_start:prolog_end] + "\n"
|
prolog = source[prolog_start:prolog_end] + "\n"
|
||||||
source = source[prolog_end: ]
|
source = source[prolog_end: ]
|
||||||
xml = etree.XML(source)
|
|
||||||
|
parser = etree.XMLParser(remove_blank_text=True)
|
||||||
|
xml = etree.fromstring(source, parser=parser)
|
||||||
return prolog + etree.tostring(xml, pretty_print=True).decode()
|
return prolog + etree.tostring(xml, pretty_print=True).decode()
|
||||||
|
|
||||||
def minimize(source: str) -> str:
|
def minimize(source: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user