use join in clean animated path

And test for empty values.
This commit is contained in:
Roberta 2021-06-13 12:00:36 -05:00 committed by GitHub
parent a1b72d5643
commit 03025e7fc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2772,11 +2772,10 @@ def clean_animated_path(element, options, stats):
These are ';' delimited path data that must keep the same number of nodes, so the only cleaning is via serializePath These are ';' delimited path data that must keep the same number of nodes, so the only cleaning is via serializePath
""" """
oldPathStr = element.getAttribute('values') oldPathStr = element.getAttribute('values')
if oldPathStr=="":
return
oldPathStrs = oldPathStr.split(';') oldPathStrs = oldPathStr.split(';')
newPathStr = "" newPathStr = ";".join(map(lambda s:serializePath(svg_parser.parse(s),options),oldPathStrs)
for oldPathStrPart in oldPathStrs:
path = svg_parser.parse(oldPathStrPart)
newPathStr += serializePath(path, options) + " ;\n"
element.setAttribute('values', newPathStr) element.setAttribute('values', newPathStr)
def parseListOfPoints(s): def parseListOfPoints(s):