Add marker-start, marker-mid, marker-end to list of SVG properties that get converted to attributes
This commit is contained in:
parent
3fc0877b7c
commit
5f8139a6e3
4 changed files with 25 additions and 1 deletions
|
|
@ -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/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/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/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 <style> 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/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/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 <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.</li>
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/594930">Bug 594930</a>, 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.</li>
|
||||||
|
|
|
||||||
7
scour.py
7
scour.py
|
|
@ -35,6 +35,8 @@
|
||||||
# at rounded corners)
|
# at rounded corners)
|
||||||
|
|
||||||
# Next Up:
|
# 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
|
# - 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
|
# - add an option to remove ids if they match the Inkscape-style of IDs
|
||||||
# - investigate point-reducing algorithms
|
# - investigate point-reducing algorithms
|
||||||
|
|
@ -69,7 +71,7 @@ except ImportError:
|
||||||
|
|
||||||
APP = 'scour'
|
APP = 'scour'
|
||||||
VER = '0.25'
|
VER = '0.25'
|
||||||
COPYRIGHT = 'Copyright Jeff Schiller, 2010'
|
COPYRIGHT = 'Copyright Jeff Schiller, Louis Simard, 2010'
|
||||||
|
|
||||||
NS = { 'SVG': 'http://www.w3.org/2000/svg',
|
NS = { 'SVG': 'http://www.w3.org/2000/svg',
|
||||||
'XLINK': 'http://www.w3.org/1999/xlink',
|
'XLINK': 'http://www.w3.org/1999/xlink',
|
||||||
|
|
@ -107,6 +109,9 @@ svgAttributes = [
|
||||||
'font-weight',
|
'font-weight',
|
||||||
'line-height',
|
'line-height',
|
||||||
'marker',
|
'marker',
|
||||||
|
'marker-end',
|
||||||
|
'marker-mid',
|
||||||
|
'marker-start',
|
||||||
'opacity',
|
'opacity',
|
||||||
'overflow',
|
'overflow',
|
||||||
'stop-color',
|
'stop-color',
|
||||||
|
|
|
||||||
|
|
@ -1136,6 +1136,15 @@ class ShortenIDsInStyleCDATA(unittest.TestCase):
|
||||||
self.assertEquals(docStr.find('somethingreallylong'), -1,
|
self.assertEquals(docStr.find('somethingreallylong'), -1,
|
||||||
'Did not shorten IDs in the internal stylesheet')
|
'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 tests for --enable-viewboxing
|
||||||
# TODO; write a test for embedding rasters
|
# TODO; write a test for embedding rasters
|
||||||
# TODO: write a test for --disable-embed-rasters
|
# TODO: write a test for --disable-embed-rasters
|
||||||
|
|
|
||||||
9
unittests/style-to-attr.svg
Normal file
9
unittests/style-to-attr.svg
Normal 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 |
Loading…
Add table
Add a link
Reference in a new issue