XML formatter script - simplify the default declaration

master
Andrey Lihatskiy 2023-11-24 09:49:19 +02:00
parent 6e63fe32ef
commit 9bf5ad98e5
1 changed files with 2 additions and 7 deletions

View File

@ -72,13 +72,8 @@ def save_xml(tree, file_path, xml_decl, indent_text=False, indent_tab=False, rm_
if rm_space:
xml_string = xml_string.replace(' />', '/>')
xml_decl = (
xml_decl if (xml_decl and not rewrite_decl) else (
'<?xml version="1.0" encoding="utf-8" standalone="yes"?>'
if rm_space else
'<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'
)
)
xml_decl = (xml_decl if (xml_decl and not rewrite_decl)
else '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>')
try:
with io.open(file_path, 'wb') as file: