I have an svg template that I am copying and customizing to create several different cards and tiles for a game. I want to programmatically (in Python, preferably) change elements from the template per-card. I seem to have no trouble finding ways to change attributes or css, but I'm having trouble finding a library where I can easily parse an existing svg and replace elements.
The svg of my template looks somewhat like this:
<!--Square 2" Tile Template -->
<svg xmlns="http://ift.tt/nvqhV5" width="181" height="181">
<text id="tile_text" y="90" width="100%"
style="text-align:center;font-family:Verdana;font-size:20">
TEXT TO REPLACE
</text>
</svg>
I have looked at Python's lxml and xml.dom.minidom but neither of them seem to support something like tile_text_element.innerHTML = "New Tile Name". Help?
EDIT:
To add a little bit about my workflow, I am creating a bunch of individualized svgs for each card, then batch rendering them to pdf through inkscape.
No comments:
Post a Comment