From 10b5a77b6c1339c6af997a19e994adaed0e88f52 Mon Sep 17 00:00:00 2001 From: jeff_schiller Date: Thu, 13 Aug 2009 05:23:22 +0000 Subject: [PATCH] Uplift scour extension to version 0.19 (fixes a few bugs) --- share/extensions/scour.py | 378 ++++++++++++++++++++++++++++++++------ 1 file changed, 319 insertions(+), 59 deletions(-) diff --git a/share/extensions/scour.py b/share/extensions/scour.py index 01c01a8a4..e82df0bb6 100755 --- a/share/extensions/scour.py +++ b/share/extensions/scour.py @@ -25,15 +25,13 @@ # (and implemented here: http://intertwingly.net/code/svgtidy/svgtidy.rb ) # Yet more ideas here: http://wiki.inkscape.org/wiki/index.php/Save_Cleaned_SVG -# TODO: Adapt this script into an Inkscape python plugin # # * Process Transformations -# * Process quadratic Bezier curves # * Collapse all group based transformations # Even more ideas here: http://esw.w3.org/topic/SvgTidy -# * removal of more default attribute values (gradientUnits, spreadMethod, x1, y1, etc) -# * analysis of path elements to see if rect can be used instead? +# * analysis of path elements to see if rect can be used instead? (must also need to look +# at rounded corners) # * removal of unused attributes in groups: # # @@ -41,30 +39,19 @@ # # # in this case, fill="blue" should be removed -# * Move common attributes up to a parent group: -# -# -# -# -# -# becomes: -# -# -# -# -# - -# Suggestion from Richard Hutch: -# * Put id attributes first in the serialization (or make the d attribute last) -# This would require my own serialization of the DOM objects (not impossible) # Next Up: -# - add an option for svgweb compatible markup (no self-closing tags)? +# + analyze all children of a group, if they have common inheritable attributes, then move them to the group +# + scour lengths for *opacity, svg:x,y,width,height, stroke-miterlimit, stroke-width +# - analyze a group and its children, if a group's attribute is not being used by any children +# (or descendants?) then remove it +# - add an option to remove ids if they match the Inkscape-style of IDs +# - investigate point-reducing algorithms +# - parse transform attribute # - if a has only one element in it, collapse the (ensure transform, etc are carried down) -# - remove id if it matches the Inkscape-style of IDs (also provide a switch to disable this) +# - option to remove metadata # - prevent elements from being stripped if they are referenced in a