Add marker-start, marker-mid, marker-end to list of SVG properties that get converted to attributes

This commit is contained in:
Jeff Schiller 2010-07-11 22:48:40 -07:00
parent 3fc0877b7c
commit 5f8139a6e3
4 changed files with 25 additions and 1 deletions

View file

@ -21,6 +21,7 @@
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/562784">Bug 562784</a>, typo in Inkscape description</li>
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/603988">Bug 603988</a>, do not commonize attributes if the element is referenced elsewhere.</li>
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/604000">Bug 604000</a>, correctly remove default overflow attributes.</li>
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/603994">Bug 603994</a>, fix parsing of &lt;style&gt; element contents when a CDATA is present</li>
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/583758">Bug 583758</a>, added a bit to the Inkscape help text saying that groups aren't collapsed if IDs are also not stripped.</li>
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/583458">Bug 583458</a>, another typo in the Inkscape help tab.</li>
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/594930">Bug 594930</a>, In a &lt;switch&gt;, require one level of &lt;g&gt; if there was a &lt;g&gt; in the file already. Otherwise, only the first subelement of the &lt;g&gt; is chosen and rendered.</li>

View file

@ -35,6 +35,8 @@
# at rounded corners)
# Next Up:
# - why are marker-start, -end not removed from the style attribute?
# - why are only overflow style properties considered and not attributes?
# - only remove unreferenced elements if they are not children of a referenced element
# - add an option to remove ids if they match the Inkscape-style of IDs
# - investigate point-reducing algorithms
@ -69,7 +71,7 @@ except ImportError:
APP = 'scour'
VER = '0.25'
COPYRIGHT = 'Copyright Jeff Schiller, 2010'
COPYRIGHT = 'Copyright Jeff Schiller, Louis Simard, 2010'
NS = { 'SVG': 'http://www.w3.org/2000/svg',
'XLINK': 'http://www.w3.org/1999/xlink',
@ -107,6 +109,9 @@ svgAttributes = [
'font-weight',
'line-height',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'opacity',
'overflow',
'stop-color',

View file

@ -1136,6 +1136,15 @@ class ShortenIDsInStyleCDATA(unittest.TestCase):
self.assertEquals(docStr.find('somethingreallylong'), -1,
'Did not shorten IDs in the internal stylesheet')
class StyleToAttr(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/style-to-attr.svg')
line = doc.getElementsByTagName('line')[0]
self.assertEquals(line.getAttribute('stroke'), '#000')
self.assertEquals(line.getAttribute('marker-start'), 'url(#m)')
self.assertEquals(line.getAttribute('marker-mid'), 'url(#m)')
self.assertEquals(line.getAttribute('marker-end'), 'url(#m)')
# TODO: write tests for --enable-viewboxing
# TODO; write a test for embedding rasters
# TODO: write a test for --disable-embed-rasters

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="m">
<rect width="200" height="100"/>
</marker>
</defs>
<line x2="100" style="stroke:#000; marker-start:url(#m); marker-end:url(#m); marker-mid: url(#m)" />
</svg>

After

Width:  |  Height:  |  Size: 252 B