Also cover quoted forms of url(#grad) for removing duplicate gradients

This commit is contained in:
Jeff Schiller 2009-08-01 10:48:55 -05:00
parent 37cfec8098
commit 9ade298cd6
2 changed files with 5 additions and 4 deletions

View file

@ -759,7 +759,8 @@ def removeDuplicateGradients(doc):
# find out which attribute referenced the duplicate gradient
for attr in ['fill', 'stroke']:
# TODO: also need to check for url("#id")
if elem.getAttribute(attr) == 'url(#'+dup_id+')':
v = elem.getAttribute(attr)
if v == 'url(#'+dup_id+')' or v == 'url("#'+dup_id+'")' or v == "url('#"+dup_id+"')":
elem.setAttribute(attr, 'url(#'+master_id+')')
if elem.getAttributeNS(NS['XLINK'], 'href') == '#'+dup_id:
elem.setAttributeNS(NS['XLINK'], 'href', '#'+master_id)