summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-02-11 20:23:00 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-02-14 11:35:45 +0100
commit75cb31432c8e928fdf75fcd2e5c14b4c543c1a8f (patch)
tree63216eb479e658c73b2dd5e9b7bf2faf4f9d20f3 /bin
parent23f1d0436f4a23b496c271c86325b8e336d60f3b (diff)
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.stahl@allotropia.de>
Diffstat (limited to 'bin')
-rw-r--r--bin/flat-odf-cleanup.py13
1 files changed, 12 insertions, 1 deletions
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)?