From 67bacc2f2322ad340fb6d8346bea0a6df74a857e Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 17 Nov 2015 22:46:50 +0100 Subject: [PATCH] Remove metadata right away (i.e. before checking for unused XML namespaces; otherwise the relevant namespaces used for metadata would not yet be unused) --- scour/scour.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scour/scour.py b/scour/scour.py index 010f686..f72e459 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -2877,6 +2877,10 @@ def scourString(in_string, options=None): global numBytesSavedInTransforms doc = xml.dom.minidom.parseString(in_string) + # remove if the user wants to + if options.remove_metadata: + removeMetadataElements(doc) + # for whatever reason this does not always remove all inkscape/sodipodi attributes/elements # on the first pass, so we do it multiple times # does it have to do with removal of children affecting the childlist? @@ -2947,10 +2951,6 @@ def scourString(in_string, options=None): if options.simple_colors: numBytesSavedInColors = convertColors(doc.documentElement) - # remove if the user wants to - if options.remove_metadata: - removeMetadataElements(doc) - # remove unreferenced gradients/patterns outside of defs # and most unreferenced elements inside of defs while removeUnreferencedElements(doc, options.keep_defs) > 0: