Also cover quoted forms of url(#grad) for removing duplicate gradients
This commit is contained in:
parent
37cfec8098
commit
9ade298cd6
2 changed files with 5 additions and 4 deletions
3
scour.py
3
scour.py
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue