From 75cb31432c8e928fdf75fcd2e5c14b4c543c1a8f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Feb 2022 20:23:00 +0100 Subject: 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 --- bin/flat-odf-cleanup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'bin') 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)? -- cgit