Closed baender closed 2 years ago
Hm. Tested that and you're right. It's likely unrelated to that bit since it's not regexed it's parsed with the xml and should be done correctly. It's something in svgelements failing to save the id. Likely it relates to it being a text object in general since they tend to nest inside each other and only become relevant after they close (since the internal text matters to the tags) and svgelements has a text object alone rather than text and tspan. Or it could just be failure to parse the id. I'll fix it pretty quick.
def test_issue_157(self):
q = io.StringIO(u'''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg>
<g id="layer1">
<text
style="font-size:18px;line-height:1.25;font-family:sans-serif;stroke-width:0.264583"
id="textobject"><tspan
id="tspanobject"
x="0"
y="0">Test</tspan></text>
</g>
</svg>
''')
m = SVG.parse(q)
q = list(m.elements())
self.assertIsNotNone(q[1].id) # Group
self.assertIsNotNone(q[2].id) # Text
self.assertIsNotNone(q[3].id) # TSpan
This test does fail and that is clearly in error.
When trying to access text elements created in Inkscape, the parser does not get the element ids correctly. This might be due to
id="text3785"><tspan
and a simple regular expression could solve the issue.