Merge branch lp:~louis-simard/scour/rework. Summary of changes:

scour.py, scour.inkscape.py, scour.inx:
 * Add options --quiet, --enable-comment-stripping, --shorten-ids, --remove-metadata, --renderer-workaround.
scour.py:
 * Optimisations in time (so Scour runs faster) and space (so Scour allocates less memory, less often).
 * Change #E+# to #e#, #E-# to #e-#, 0.# to .# and -0.# into -.# in path/polygon/polyline data + lengths, if renderer workarounds are disabled. Use spaces instead of commas in path/polygon/polyline data. Use lower-case #rrggbb and #rgb instead of upper-case. All of this makes gzip work better, since the rest of SVG documents mostly has lower-case letters in tag names and spaces to separate XML attributes etc.
 * Fix a bug whereby an SVG document would become filled with black if all elements had the same fill color.
 * Fix a bug whereby a path's second command would not start at the right coordinates if the first command was a relative moveto 'm' with at least 1 implied lineto.
 * Fix a bug whereby a path's absolute lineto 'L' commands would not become the right relative lineto 'l' commands.
 * Allow the implicit linetos after a path's moveto 'M'/'m' to be converted into relative horizontal linetos 'h' and vertical 'v' too.
scour.inx:
 * Fix help typos. Make options more descriptive in the plugin option window. Add something about enable-group-collapsing requiring enable-id-stripping.
testscour.py:
 * Rework tests that relied on #E+#, #E-#, 0.# and -0.# so that they accept the changes to scour.py. Add unit tests for strip-xml-prolog, enable-comment-stripping and remove-metadata.
This commit is contained in:
Cynthia Gauthier 2010-06-15 20:58:57 -04:00
parent 00804fb833
commit f4cca44faf
9 changed files with 1153 additions and 518 deletions

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Oh look a comment -->
<svg xmlns="http://www.w3.org/2000/svg">
</svg>

After

Width:  |  Height:  |  Size: 130 B

View file

@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
<rdf:RDF
xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs = "http://www.w3.org/2000/01/rdf-schema#"
xmlns:dc = "http://purl.org/dc/elements/1.1/" >
<rdf:Description about="http://example.org/myfoo"
dc:title="MyFoo"
dc:description="Unit test for Scour's --remove-metadata option"
dc:publisher="No One"
dc:date="2010-06-09"
dc:format="image/svg+xml"
dc:language="en" >
<dc:creator>
<rdf:Bag>
<rdf:li>No One</rdf:li>
</rdf:Bag>
</dc:creator>
</rdf:Description>
</rdf:RDF>
</metadata>
</svg>

After

Width:  |  Height:  |  Size: 764 B

10
unittests/shorten-ids.svg Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
<defs>
<linearGradient id="this-abomination-should-be-shortened-to-a-single-letter">
<stop offset="0" stop-color="black" />
<stop offset="1" stop-color="white" />
</linearGradient>
</defs>
<rect fill="url(#this-abomination-should-be-shortened-to-a-single-letter)" x="20" y="20" width="160" height="160" />
</svg>

After

Width:  |  Height:  |  Size: 447 B