From c9ecfc05a7a25a41c1f6ae50d779e1fe5b65c627 Mon Sep 17 00:00:00 2001 From: JSCHILL1 Date: Mon, 3 Aug 2009 17:44:40 -0500 Subject: [PATCH] Remove redundant SVG namespace declarations and prefixes --- fulltests/lightning.svg | 82 +++++++++++++++++++++++++++ release-notes.html | 2 + scour.py | 61 +++++++++++++++++++- testscour.py | 13 +++++ unittests/redundant-svg-namespace.svg | 6 ++ 5 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 fulltests/lightning.svg create mode 100644 unittests/redundant-svg-namespace.svg diff --git a/fulltests/lightning.svg b/fulltests/lightning.svg new file mode 100644 index 0000000..4db6001 --- /dev/null +++ b/fulltests/lightning.svg @@ -0,0 +1,82 @@ + + + + + + + + Lightning Icon + + + + icon + weather + lightning + + + + + Benji Park + + + + + Benji Park + + + + + Benji Park + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/release-notes.html b/release-notes.html index 1b16632..fdd9e17 100644 --- a/release-notes.html +++ b/release-notes.html @@ -19,6 +19,8 @@
  • Remove duplicate gradients
  • Remove empty q,a path segments
  • Scour polyline coordinates just like path/polygon
  • +
  • Scour lengths from most attributes
  • +
  • Remove redundant SVG namespace declarations and prefixes
  • diff --git a/scour.py b/scour.py index 7efa12b..21cb2e0 100755 --- a/scour.py +++ b/scour.py @@ -32,7 +32,6 @@ # * Collapse all group based transformations # Even more ideas here: http://esw.w3.org/topic/SvgTidy -# * namespace cleanup -> # * removal of more default attribute values (gradientUnits, spreadMethod, x1, y1, etc) # * analysis of path elements to see if rect can be used instead? # * removal of unused attributes in groups: @@ -63,7 +62,9 @@ # + remove duplicate gradients # + remove all empty path segments # + scour polyline coordinates just like path coordinates -# - enable the precision argument to affect all numbers: lengths, coordinates +# + scour all lengths, coordinates +# + remove redundant SVG namespace declarations and prefixes +# - 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) # - prevent elements from being stripped if they are referenced in a