scour-project / scour

Scour - An SVG Optimizer / Cleaner
Apache License 2.0
757 stars 61 forks source link

[feature request] delete empty tspan #294

Open JoKalliauer opened 2 years ago

JoKalliauer commented 2 years ago

Emtpy <tspan/> without sodipodi:role="line" should be removed. (However SVGO supports this feature.)

Input = Output

<?xml version="1.0" encoding="UTF-8"?>
<svg width="447.2pt" height="282.75pt" viewBox="0 0 447.2 282.75" xmlns="http://www.w3.org/2000/svg">
 <text x="264.96" y="201.83" stroke-width="1.8"><tspan x="264.96" y="201.83"/><tspan x="264.96" y="216.12"/><tspan x="264.96" y="230.4"/><tspan x="264.96" y="244.69"/><tspan x="264.96" y="258.97"/><tspan x="264.96" y="273.25"/><tspan x="264.96" y="287.54"/><tspan x="264.96" y="301.82"/><tspan x="264.96" y="316.11"/></text>
 <text x="264.09" y="136.5" stroke-width="1.81"><tspan x="264.09" y="136.5"/><tspan x="264.09" y="150.86"/></text>
 <text x="264.09" y="136.5" stroke-width="1.81"><tspan x="264.09" y="136.5"/><tspan x="264.09" y="150.86"/><tspan x="264.09" y="165.23"/><tspan x="264.09" y="179.6"/><tspan x="264.09" y="193.97"/></text>
 <text transform="scale(.75)"/>
</svg>

Output by SVGO (desired)

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 447.2 282.75"/>