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
|
# find out which attribute referenced the duplicate gradient
|
||||||
for attr in ['fill', 'stroke']:
|
for attr in ['fill', 'stroke']:
|
||||||
# TODO: also need to check for url("#id")
|
# 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+')')
|
elem.setAttribute(attr, 'url(#'+master_id+')')
|
||||||
if elem.getAttributeNS(NS['XLINK'], 'href') == '#'+dup_id:
|
if elem.getAttributeNS(NS['XLINK'], 'href') == '#'+dup_id:
|
||||||
elem.setAttributeNS(NS['XLINK'], 'href', '#'+master_id)
|
elem.setAttributeNS(NS['XLINK'], 'href', '#'+master_id)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<radialGradient xlink:href="#g2" id="g4" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1, 0, 0, 0.481529, -718.417, 98.7046)" cx="323.75433" cy="209.73672" fx="323.75433" fy="209.73672" r="6.2794499"/>
|
<radialGradient xlink:href="#g2" id="g4" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1, 0, 0, 0.481529, -718.417, 98.7046)" cx="323.75433" cy="209.73672" fx="323.75433" fy="209.73672" r="6.2794499"/>
|
||||||
|
|
||||||
<rect id="r1" fill="url(#g1)" width="100" height="100"/>
|
<rect id="r1" fill="url(#g1)" width="100" height="100"/>
|
||||||
<rect id="r2" stroke="url(#g2)" width="100" height="100"/>
|
<rect id="r2" stroke="url('#g2')" width="100" height="100"/>
|
||||||
<rect id="r3" stroke="url(#g3)" width="100" height="100"/>
|
<rect id="r3" stroke="url(#g3)" width="100" height="100"/>
|
||||||
<rect id="r4" fill="url(#g4)" width="100" height="100"/>
|
<rect id="r4" fill='url("#g4")' width="100" height="100"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue