Thank you very much for that pointer. Yes, I know they're text files. I've been editing them with awk, but it's a bit of a fiddle getting the context right - you have to find the text, then work back to the object that it's contained in. Not impossible, but it looks as if an inkscape extension might be a more sensible solution since it knows about the objects.
On 27 February 2015 at 14:18, Vasco <vasco+python@...3082...> wrote:
Dear Peter,
SVG files are plain text files. You mention in your explanation that you only have to replace a certain string (one url with another one). This can be done with any editor, for example with sed (http://stackoverflow.com/questions/10309968/sed-search-and-replace-strings-c...).
If you have to do more logic, it is better to write an inkscape extension. This is just a script, that reads a svg file and outputs the converted svg file. I have good experiences writing extensions in python.
A relevant resource is: http://wiki.inkscape.org/wiki/index.php/PythonEffectTutorial
Here the inkex class does all the reading/writing of the files. I wrote: https://bitbucket.org/vascotenner/inkscape-fix_text_boxes
Kind regards, Vasco
On 26-02-15 06:31, Peter Brooks wrote:
I've been trying to do this for a while now, and I hoped that it'd be possible with the inkscape command line, but I'm new to this, so I can't see how.
I've got a .svg file that's from the OpenGroup's Archi application. It's got boxes and links with names.
What I'd like to do is make the names clickable. So, for example, the box:
---------------------- | | | my_label | | | ----------------------
Would be clickable, as a box, and go to:
This will work because I'm using a wiki, so the 'my_label' will become a page on the wiki.
Is there a way to get inkscape to add the link:
<a xlink:href="http://mywebsite.com/my_label"> box </a>
Or, in other words, to translate:
<a xlink:href="http://takingserviceforward.org/wiki/index.php?title=Service_agreement">
<text fill="black" x="332" xml:space="preserve" y="159" clip-path="url(#clipPath8)" stroke="none" id="text88738">My_Label</text> <rect x="1356" y="370" clip-path="url(#clipPath5)" fill="none" width="246" rx="27.5" ry="27.5" height="54" stroke="rgb(255,255,181)" id="rect88726" />
To:
<a xlink:href="http://takingserviceforward.org/wiki/index.php?title=My_Label"> <text fill="black" x="332" xml:space="preserve" y="159" clip-path="url(#clipPath8)" stroke="none" id="text88738">My_Label</text> <rect x="1356" y="370" clip-path="url(#clipPath5)" fill="none" width="246" rx="27.5" ry="27.5" height="54" stroke="rgb(255,255,181)" id="rect88726" /> </a>
I'd be grateful for any suggestions - if there's something else that manipulates .svg files that could do this, it'd be good to know!
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user