scour
scour copied to clipboard
--strip-xml-space leads to wrong spaces in <text>
Processing File:Alloy_cooling_curves_mixed_crystals.svg leads to wrong spaces.
scour -i input.svg.txt -o output.svg.txt --strip-xml-space
Input
<?xml version="1.0" encoding="UTF-8"?>
<svg width="623" height="599" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<text x="54.81" y="27.27" font-family="Arabic Typesetting" font-size="36" letter-spacing="0" word-spacing="0"> <tspan x="54.81" y="27.27">2 3 4 5 6</tspan> </text>
</svg>
Scour-Output
<?xml version="1.0" encoding="UTF-8"?>
<svg width="623" height="599" xmlns="http://www.w3.org/2000/svg">
<text x="54.81" y="27.27" font-family="Arabic Typesetting" font-size="36" letter-spacing="0" word-spacing="0"><tspan x="54.81" y="27.27">2 3 4 5 6</tspan></text>
</svg>
Wanted, Desired
<svg width="623" height="599" xmlns="http://www.w3.org/2000/svg">
<text xml:space="preserve" x="54.81" y="27.27" font-family="Arabic Typesetting" font-size="36" letter-spacing="0" word-spacing="0"> <tspan x="54.81" y="27.27" xml:space="preserve">2 3 4 5 6</tspan> </text>
</svg>
xml:space="preserve"
should be removed in the <svg
-tag and applied to all child-elements.
Then xml:space="preserve"
should be removed from <rect
, <path
, circle
, ellipse
, image
and all <g
-tags only containing mentioned tags (maybe also all selfclosing tags).
Applying it to all <text
which are not defined differently (xml:space="none"
), would remove it from unknown tags such as <flowRoot
.
Copyright
License:cc-by-sa-3.0
Author: Ra'ike
source: https://commons.wikimedia.org/wiki/File:Alloy_cooling_curves_mixed_crystals.svg
Well, this is not a bug but documented behavior.
We could consider re-adding the xml:space="preserve"
for text nodes as an enhancement in future, though.