Code

fix an old bug in the style splitting routine and add to the makefile
[inkscape.git] / share / extensions / markers_strokepaint.py
index f49a37a773d5f19ba12118579ee5768e4dc7ff8d..163767f1aaa4f5d423c16055eba39c4e5fa5dfd2 100644 (file)
@@ -32,7 +32,7 @@ class MyEffect(inkex.Effect):
         self.ctx = inkex.xml.xpath.Context.Context(self.document,processorNss=inkex.NSS)\r
         defs = self.xpathSingle('/svg/defs')  \r
         for id, node in self.selected.iteritems():\r
-            mprops = ['marker-start','marker-mid','marker-end']\r
+            mprops = ['marker','marker-start','marker-mid','marker-end']\r
             style = simplestyle.parseStyle(node.attributes.getNamedItem('style').value)\r
             \r
             try:\r
@@ -43,15 +43,16 @@ class MyEffect(inkex.Effect):
             for mprop in mprops:\r
                 if style.has_key(mprop) and style[mprop] != 'none'and style[mprop][:5] == 'url(#':\r
                     marker_id = style[mprop][5:-1]\r
-                    old_mnode = self.xpathSingle('/svg/defs/marker[@id="%s"]' % marker_id)\r
+                    old_mnode = self.xpathSingle('/svg//marker[@id="%s"]' % marker_id)\r
                     mnode = old_mnode.cloneNode(True)\r
                     new_id = "%s%s" % (marker_id,2)\r
                     style[mprop] = "url(#%s)" % new_id\r
                     mnode.attributes.getNamedItem('id').value = new_id\r
                     defs.appendChild(mnode)\r
                     \r
-                    children = inkex.xml.xpath.Evaluate('/svg/defs/marker[@id="%s"]//*[@style]' % new_id,self.document,context=self.ctx)\r
+                    children = inkex.xml.xpath.Evaluate('/svg//marker[@id="%s"]//*[@style]' % new_id,self.document,context=self.ctx)\r
                     for child in children:\r
+                        inkex.debug(child.attributes.getNamedItem('style').value)\r
                         cstyle = simplestyle.parseStyle(child.attributes.getNamedItem('style').value)\r
                         if (cstyle.has_key('stroke') and cstyle['stroke'] != 'none') or not cstyle.has_key('stroke'):\r
                                 cstyle['stroke'] = stroke\r