[Libreoffice-commits] mso-dumper.git: pptx-kill-uuid.py
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Feb 1 16:13:08 UTC 2019
pptx-kill-uuid.py | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
New commits:
commit f4faef33537d96307a198e09ccf1511cf74c7b62
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 1 16:57:08 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Feb 1 17:12:50 2019 +0100
pptx: add script that makes smartart uuids more readable
diff --git a/pptx-kill-uuid.py b/pptx-kill-uuid.py
new file mode 100755
index 0000000..c930ece
--- /dev/null
+++ b/pptx-kill-uuid.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# PowerPoint generates SmartArt streams, like ppt/diagrams/data1.xml containing
+# UUIDs for each <dgm:pt> element. This makes it hard to reason about them,
+# referring to numerical identifiers is just easier in notes. This script
+# replaces UUIDs with integers, which is the style used in the OOXML spec as
+# well.
+
+import re
+import sys
+
+
+def main():
+ buf = sys.stdin.read()
+
+ counter = 0
+ while True:
+ match = re.search("\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}", buf)
+ if not match:
+ break
+ uuid = match.group()
+ buf = buf.replace(uuid, str(counter))
+ counter += 1
+
+ sys.stdout.write(buf)
+
+
+if __name__ == "__main__":
+ main()
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list