From 404c013e5f00457a657ebf43d724f21d0b3a7b5b Mon Sep 17 00:00:00 2001 From: Cynthia Gauthier Date: Fri, 2 Jul 2010 05:35:31 -0400 Subject: [PATCH] Implement the feature described in bug 598976: Create a with the common attributes of a run of elements if there are 3 or more elements in the run. --- scour.inkscape.py | 3 + scour.inx | 8 ++- scour.py | 124 ++++++++++++++++++++++++++++++-- testscour.py | 22 ++++++ unittests/group-creation.svg | 6 ++ unittests/group-no-creation.svg | 6 ++ 6 files changed, 162 insertions(+), 7 deletions(-) create mode 100644 unittests/group-creation.svg create mode 100644 unittests/group-no-creation.svg diff --git a/scour.inkscape.py b/scour.inkscape.py index ad3bfcd..ebbae81 100755 --- a/scour.inkscape.py +++ b/scour.inkscape.py @@ -19,6 +19,9 @@ class ScourInkscape (inkex.Effect): self.OptionParser.add_option("--group-collapsing", type="inkbool", action="store", dest="group_collapse", default=True, help="won't collapse elements") + self.OptionParser.add_option("--create-groups", type="inkbool", + action="store", dest="group_create", default=False, + help="create elements for runs of elements with identical attributes") self.OptionParser.add_option("--enable-id-stripping", type="inkbool", action="store", dest="strip_ids", default=False, help="remove all un-referenced ID attributes") diff --git a/scour.inx b/scour.inx index 4254882..26d9b62 100644 --- a/scour.inx +++ b/scour.inx @@ -10,6 +10,7 @@ true true true + true false false true @@ -18,7 +19,7 @@ false false false - false + false 5 <_item value="space">Space @@ -29,8 +30,9 @@ <_param name="instructions" type="description" xml:space="preserve">This extension optimizes the SVG file according to the following options: * Shorten color names: convert all colors to #RRGGBB or #RGB format. - * Convert CSS attributes to XML attributes: convert styles from