diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-05-06 20:53:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-05-07 09:46:33 +0200 |
commit | 8d45e67fe97773666cb5e2db04822476872fa84f (patch) | |
tree | 8bb66906c6ad29945b7004531faa2f384565a3cd /bin | |
parent | d64192e72e76142097ca20f3df8a99373c792f81 (diff) |
preserve comments before root entry
Change-Id: I5fc789258e605b2d74c6697dedd824d722ad53bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115217
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ui-converter-skeleton.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/bin/ui-converter-skeleton.py b/bin/ui-converter-skeleton.py index ac27eb5304af..49c23669e800 100755 --- a/bin/ui-converter-skeleton.py +++ b/bin/ui-converter-skeleton.py @@ -189,12 +189,6 @@ def remove_check_button_align(current): with open(sys.argv[1], encoding="utf-8") as f: header = f.readline() - firstline = f.readline() - # the comment after the xml declaration goes missing unless we provide a - # custom doctype with tostring that contains the comment as a line after - # the true doctype - if firstline.startswith("<!--"): - header = header + firstline f.seek(0) # remove_blank_text so pretty-printed input doesn't disrupt pretty-printed # output if nodes are added or removed @@ -217,6 +211,6 @@ remove_check_button_align(root) with open(sys.argv[1], 'wb') as o: # without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX replacements for non-ascii characters # which we don't want to see changed in the output - o.write(etree.tostring(root, pretty_print=True, method='xml', encoding='unicode', doctype=header[0:-1]).encode("utf8")) + o.write(etree.tostring(tree, pretty_print=True, method='xml', encoding='unicode', doctype=header[0:-1]).encode("utf8")) # vim: set shiftwidth=4 softtabstop=4 expandtab: |