RazrFalcon / svgcleaner

svgcleaner could help you to clean up your SVG files from the unnecessary data.
GNU General Public License v2.0
1.62k stars 93 forks source link

comments in text nodes were removed with --remove-comments no #190

Open JoKalliauer opened 5 years ago

JoKalliauer commented 5 years ago

Prozessing File:McCree-Kurve_1_DE.svg leads to a removement of the comments

svgcleaner Input.svg.txt output.svg.txt --allow-bigger-file --indent 1 --remove-comments no

lead to Warning: 'text' element should contain only element and text nodes

but according to https://www.w3.org/TR/2011/WD-SVG11-20110512/struct.html <text systemLanguage="mi, en"><!-- content goes here --></text> should be correct syntax.

Input

Input.svg.txt

<svg font-family="DejaVu Sans,sans-serif" font-size="450" viewBox="0 0 16300 10100" xmlns="http://www.w3.org/2000/svg">
 <text text-anchor="middle" transform="rotate(-90)" x="-4500" y="15800">relative Quantenausbeute [%]</text>
 <text><!-- -
- --><tspan x="14500" y="1120">100</tspan><!-- -
- --><tspan x="14500" y="1840">90</tspan><!-- -
- --><tspan x="14500" y="2560">80</tspan><!-- -
- --><tspan x="14500" y="3280">70</tspan><!-- -
- --><tspan x="14500" y="4000">60</tspan><!-- -
- --><tspan x="14500" y="4720">50</tspan><!-- -
- --><tspan x="14500" y="5440">40</tspan><!-- -
- --><tspan x="14500" y="6160">30</tspan><!-- -
- --><tspan x="14500" y="6880">20</tspan><!-- -
- --><tspan x="14500" y="7600">10</tspan><!-- -
- --></text>
 <text text-anchor="middle" x="8200" y="9700">Wellenlänge [nm]</text>
 <text text-anchor="end" transform="rotate(-90)"><!-- -
- --><tspan x="-8400" y="2150">300</tspan><!-- -
- --><tspan x="-8400" y="4600">400</tspan><!-- -
- --><tspan x="-8400" y="7050">500</tspan><!-- -
- --><tspan x="-8400" y="9520">600</tspan><!-- -
- --><tspan x="-8400" y="11980">700</tspan><!-- -
- --><tspan x="-8400" y="14450">800</tspan><!-- -
- --></text>
 <g text-anchor="middle">
  <text x="3200" y="8700">UV</text>
  <text x="13000" y="8700">IR</text>
  <text transform="rotate(-90)" x="-4500" y="800">relative Energie [%]</text>
 </g>
 <text text-anchor="end"><!-- -
- --><tspan x="1700" y="1120">100</tspan><!-- -
- --><tspan x="1700" y="1840">90</tspan><!-- -
- --><tspan x="1700" y="2560">80</tspan><!-- -
- --><tspan x="1700" y="3280">70</tspan><!-- -
- --><tspan x="1700" y="4000">60</tspan><!-- -
- --><tspan x="1700" y="4720">50</tspan><!-- -
- --><tspan x="1700" y="5440">40</tspan><!-- -
- --><tspan x="1700" y="6160">30</tspan><!-- -
- --><tspan x="1700" y="6880">20</tspan><!-- -
- --><tspan x="1700" y="7600">10</tspan><!-- -
- --></text>
</svg>

Output

output.svg.txt

<svg font-family="DejaVu Sans,sans-serif" font-size="450" viewBox="0 0 16300 10100" xmlns="http://www.w3.org/2000/svg">
 <text text-anchor="middle" transform="rotate(-90)" x="-4500" y="15800">relative Quantenausbeute [%]</text>
 <text><tspan x="14500" y="1120">100</tspan><tspan x="14500" y="1840">90</tspan><tspan x="14500" y="2560">80</tspan><tspan x="14500" y="3280">70</tspan><tspan x="14500" y="4000">60</tspan><tspan x="14500" y="4720">50</tspan><tspan x="14500" y="5440">40</tspan><tspan x="14500" y="6160">30</tspan><tspan x="14500" y="6880">20</tspan><tspan x="14500" y="7600">10</tspan></text>
 <text text-anchor="middle" x="8200" y="9700">Wellenlänge [nm]</text>
 <text text-anchor="end" transform="rotate(-90)"><tspan x="-8400" y="2150">300</tspan><tspan x="-8400" y="4600">400</tspan><tspan x="-8400" y="7050">500</tspan><tspan x="-8400" y="9520">600</tspan><tspan x="-8400" y="11980">700</tspan><tspan x="-8400" y="14450">800</tspan></text>
 <g text-anchor="middle">
  <text x="3200" y="8700">UV</text>
  <text x="13000" y="8700">IR</text>
  <text transform="rotate(-90)" x="-4500" y="800">relative Energie [%]</text>
 </g>
 <text text-anchor="end"><tspan x="1700" y="1120">100</tspan><tspan x="1700" y="1840">90</tspan><tspan x="1700" y="2560">80</tspan><tspan x="1700" y="3280">70</tspan><tspan x="1700" y="4000">60</tspan><tspan x="1700" y="4720">50</tspan><tspan x="1700" y="5440">40</tspan><tspan x="1700" y="6160">30</tspan><tspan x="1700" y="6880">20</tspan><tspan x="1700" y="7600">10</tspan></text>
</svg>
Copyright Lizense: CC0 source: https://commons.wikimedia.org/wiki/File:McCree-Kurve_1_DE.svg
RazrFalcon commented 5 years ago

Yes. It's not supported, afair.