[Libreoffice-commits] core.git: bin/ui-converter-skeleton.py

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri May 7 07:47:17 UTC 2021


 bin/ui-converter-skeleton.py |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

New commits:
commit 8d45e67fe97773666cb5e2db04822476872fa84f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 6 20:53:18 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 7 09:46:33 2021 +0200

    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 at redhat.com>

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:


More information about the Libreoffice-commits mailing list