bin/flat-odf-cleanup.py |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 75cb31432c8e928fdf75fcd2e5c14b4c543c1a8f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Feb 11 20:23:00 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Feb 14 11:35:45 2022 +0100

    flat-odf-cleanup.py: remove rsid attributes
    
    Change-Id: I2d2bcd2bce525b111906c59d2d119e1d63d2174b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129852
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/bin/flat-odf-cleanup.py b/bin/flat-odf-cleanup.py
index 27d58c48936f..cbaf03c65e7b 100644
--- a/bin/flat-odf-cleanup.py
+++ b/bin/flat-odf-cleanup.py
@@ -224,6 +224,18 @@ def remove_unused(root):
             print("removing unused font-face " + 
font.get("{urn:oasis:names:tc:opendocument:xmlns:style:1.0}name"))
             
root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}font-face-decls").remove(font)
 
+    # 14) remove rsid attributes
+    styles = 
root.findall(".//{urn:oasis:names:tc:opendocument:xmlns:style:1.0}style")
+    for style in styles:
+        tp = 
style.find(".//{urn:oasis:names:tc:opendocument:xmlns:style:1.0}text-properties")
+        if tp is not None:
+            if "{http://openoffice.org/2009/office}rsid"; in tp.attrib:
+                print("removing rsid from " + 
style.get("{urn:oasis:names:tc:opendocument:xmlns:style:1.0}name"))
+                del tp.attrib["{http://openoffice.org/2009/office}rsid";]
+            if "{http://openoffice.org/2009/office}paragraph-rsid"; in 
tp.attrib:
+                print("removing paragraph-rsid from " + 
style.get("{urn:oasis:names:tc:opendocument:xmlns:style:1.0}name"))
+                del 
tp.attrib["{http://openoffice.org/2009/office}paragraph-rsid";]
+
     # remove office:settings
     settings = 
root.find(".//{urn:oasis:names:tc:opendocument:xmlns:office:1.0}settings")
     if settings:
@@ -234,7 +246,6 @@ def remove_unused(root):
     if scripts:
         root.remove(scripts)
 
-    # TODO: remove rsid attributes
     # TODO: replace embedded image with some tiny one
     # TODO: perhaps replace text with xxx (optionally)?
 

Reply via email to