Remove metadata right away

(i.e. before checking for unused XML namespaces; otherwise the relevant namespaces used for metadata would not yet be unused)
This commit is contained in:
Eduard Braun 2015-11-17 22:46:50 +01:00
parent b979fe19e5
commit 67bacc2f23

View file

@ -2877,6 +2877,10 @@ def scourString(in_string, options=None):
global numBytesSavedInTransforms
doc = xml.dom.minidom.parseString(in_string)
# remove <metadata> 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 <metadata> 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: