diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 91f5f24..1a00d08 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,5 +1,16 @@ Thanks to the following contributors to scour: +* Louis Simard + Bugs Fixed: + - https://bugs.launchpad.net/scour/+bug/583758 + - https://bugs.launchpad.net/scour/+bug/583458 + - https://bugs.launchpad.net/scour/+bug/594930 + - https://bugs.launchpad.net/scour/+bug/576958 + New features: + - https://bugs.launchpad.net/scour/+bug/428069 Remove metadata option. + - https://bugs.launchpad.net/scour/+bug/582619 Feature implementations: --quiet, --enable-comment-stripping. + - Add options --shorten-ids, --renderer-workaround. + * Doug Schepers (W3C SVG WG) - function to embed rasters as base64 data: URLs - report file size reduction diff --git a/release-notes.html b/release-notes.html index 91594d8..9561a61 100644 --- a/release-notes.html +++ b/release-notes.html @@ -20,6 +20,12 @@
  • Fix Bug 577940 to include stroke-dasharray into list of style properties turned into XML attributes.
  • Fix Bug 562784, typo in Inkscape description
  • Fix Bug 603988, do not commonize attributes if the element is referenced elsewhere.
  • +
  • Fix Bug 604000, correctly remove default overflow attributes.
  • +
  • Fix Bug 583758, added a bit to the Inkscape help text saying that groups aren't collapsed if IDs are also not stripped.
  • +
  • Fix Bug 583458, another typo in the Inkscape help tab.
  • +
  • Fix Bug 594930, In a <switch>, require one level of <g> if there was a <g> in the file already. Otherwise, only the first subelement of the <g> is chosen and rendered.
  • +
  • Fix Bug 576958, "Viewbox option doesn't work when units are set", when renderer workarounds are disabled.
  • +
  • Added many options: --remove-metadata, --quiet, --enable-comment-stripping, --shorten-ids, --renderer-workaround.
  • diff --git a/scour.py b/scour.py index 161b45c..6c50c786 100755 --- a/scour.py +++ b/scour.py @@ -4,6 +4,7 @@ # Scour # # Copyright 2010 Jeff Schiller +# Copyright 2010 Louis Simard # # This file is part of Scour, http://www.codedread.com/scour/ # @@ -1328,12 +1329,24 @@ def repairStyle(node, options): del styleMap['display'] num += 1 - # overflow: visible or overflow specified on element other than svg, marker, pattern if styleMap.has_key('overflow') : - if styleMap['overflow'] == 'visible' or node.nodeName in ['svg','marker','pattern']: + # overflow specified on element other than svg, marker, pattern + if not node.nodeName in ['svg','marker','pattern']: del styleMap['overflow'] num += 1 - + # it is a marker, pattern or svg + # as long as this node is not the document , then only + # remove overflow='hidden'. See + # http://www.w3.org/TR/2010/WD-SVG11-20100622/masking.html#OverflowProperty + elif node != node.ownerDocument.documentElement: + if styleMap['overflow'] == 'hidden': + del styleMap['overflow'] + num += 1 + # else if outer svg has a overflow="visible", we can remove it + elif styleMap['overflow'] == 'visible': + del styleMap['overflow'] + num += 1 + # marker: none if styleMap.has_key('marker') : if styleMap['marker'] == 'none': diff --git a/svg_transform.py b/svg_transform.py index 4a69d75..07b523c 100644 --- a/svg_transform.py +++ b/svg_transform.py @@ -3,7 +3,7 @@ # SVG transformation list parser # -# Copyright 2010 +# Copyright 2010 Louis Simard # # This file is part of Scour, http://www.codedread.com/scour/ # diff --git a/testscour.py b/testscour.py index 8349234..68d29bb 100755 --- a/testscour.py +++ b/testscour.py @@ -4,6 +4,7 @@ # Test Harness for Scour # # Copyright 2010 Jeff Schiller +# Copyright 2010 Louis Simard # # This file is part of Scour, http://www.codedread.com/scour/ # @@ -1102,6 +1103,19 @@ class DoNotCommonizeAttributesOnReferencedElements(unittest.TestCase): doc = scour.scourXmlFile('unittests/commonized-referenced-elements.svg') self.assertEquals(doc.getElementsByTagName('circle')[0].getAttribute('fill'), '#0f0') +class DoNotRemoveOverflowVisibleOnMarker(unittest.TestCase): + def runTest(self): + doc = scour.scourXmlFile('unittests/overflow-marker.svg') + self.assertEquals(doc.getElementsByTagName('marker')[0].getAttribute('overflow'), 'visible') + self.assertEquals(doc.getElementsByTagName('marker')[1].getAttribute('overflow'), '') + +class MarkerOnSvgElements(unittest.TestCase): + def runTest(self): + doc = scour.scourXmlFile('unittests/overflow-svg.svg') + self.assertEquals(doc.getElementsByTagName('svg')[0].getAttribute('overflow'), '') + self.assertEquals(doc.getElementsByTagName('svg')[1].getAttribute('overflow'), '') + self.assertEquals(doc.getElementsByTagName('svg')[2].getAttribute('overflow'), 'visible') + # TODO: write tests for --enable-viewboxing # TODO; write a test for embedding rasters # TODO: write a test for --disable-embed-rasters diff --git a/unittests/overflow-marker.svg b/unittests/overflow-marker.svg new file mode 100644 index 0000000..ec068d9 --- /dev/null +++ b/unittests/overflow-marker.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/unittests/overflow-svg.svg b/unittests/overflow-svg.svg new file mode 100644 index 0000000..8830a80 --- /dev/null +++ b/unittests/overflow-svg.svg @@ -0,0 +1,9 @@ + + + + + + + + +