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:
parent
00804fb833
commit
f4cca44faf
9 changed files with 1153 additions and 518 deletions
|
|
@ -22,12 +22,18 @@ class ScourInkscape (inkex.Effect):
|
|||
self.OptionParser.add_option("--enable-id-stripping", type="inkbool",
|
||||
action="store", dest="strip_ids", default=False,
|
||||
help="remove all un-referenced ID attributes")
|
||||
self.OptionParser.add_option("--shorten-ids", type="inkbool",
|
||||
action="store", dest="shorten_ids", default=False,
|
||||
help="shorten all ID attributes to the least number of letters possible")
|
||||
self.OptionParser.add_option("--embed-rasters", type="inkbool",
|
||||
action="store", dest="embed_rasters", default=True,
|
||||
help="won't embed rasters as base64-encoded data")
|
||||
self.OptionParser.add_option("--keep-editor-data", type="inkbool",
|
||||
action="store", dest="keep_editor_data", default=False,
|
||||
help="won't remove Inkscape, Sodipodi or Adobe Illustrator elements and attributes")
|
||||
self.OptionParser.add_option("--remove-metadata", type="inkbool",
|
||||
action="store", dest="remove_metadata", default=False,
|
||||
help="remove <metadata> elements (which may contain license metadata etc.)")
|
||||
self.OptionParser.add_option("--strip-xml-prolog", type="inkbool",
|
||||
action="store", dest="strip_xml_prolog", default=False,
|
||||
help="won't output the <?xml ?> prolog")
|
||||
|
|
@ -40,7 +46,12 @@ class ScourInkscape (inkex.Effect):
|
|||
self.OptionParser.add_option("--enable-viewboxing", type="inkbool",
|
||||
action="store", dest="enable_viewboxing", default=False,
|
||||
help="changes document width/height to 100%/100% and creates viewbox coordinates")
|
||||
|
||||
self.OptionParser.add_option("--enable-comment-stripping", type="inkbool",
|
||||
action="store", dest="strip_comments", default=False,
|
||||
help="remove all <!-- --> comments")
|
||||
self.OptionParser.add_option("--renderer-workaround", type="inkbool",
|
||||
action="store", dest="renderer_workaround", default=False,
|
||||
help="work around various renderer bugs (currently only librsvg)")
|
||||
|
||||
def effect(self):
|
||||
input = file(sys.argv[12], "r")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue