3

I am developing a tool that will take Inkscape made SVG files.

I want to make it so I enter various tagings like {{="test this"}} And my renderer, made it myself, would then replace the item with properly escape and valid stuff in the svg.

Similar to the way one might use and HTML document template I am doing it as an SVG.

Is there a way for me to edit the file in Inkscape and not have to worry about manually going in and replacing all my " parts with actually "? There may be other characters too, just haven't looked yet.

The idea is that a designer makes very little changes in hist svg to make a dynamic image with a controller passing a context to it.

Here is a video of the issue: https://youtu.be/76pES20gFHg

  • Usually server-side applications are written in a language that has built-in functions for such things (html_entity_decode for instance). If you are looking to make a placeholder, you can make up something like "<<BOOKMARK_MYSTUFF>>" or, better yet, use a parameter ( stackoverflow.com/questions/27812161/… ) – Yorik Oct 20 '15 at 19:18
  • If you are merely pre-processing the files locally to prep them for a template system, then any agreed-upon phrasing/suffix that is extremely unlikely to be encountered in normal usage is probably good enough. – Yorik Oct 20 '15 at 19:25
1

SVG documents have to be valid XML. There are 5 forbidden characters in XML that you have to escape with entities:

  • " is written &quot;
  • ' is written &apos;
  • < is written &lt;
  • > is written &gt;
  • & is written &amp;

… and note that it is only those 5 — the HTML entities are not there in an XML parser.

If you put any un-escaped versions of the above characters into your SVG document, it stops being an SVG document and becomes a plain text document that looks a little like XML. You can’t expect that document to be rendered as an SVG graphic.

0

I solved it by added a special processor to my templates before I run the code in them.

Basicaly anything inside {{ and }} I checked for charactors like the " and replaced them with " This seems to do this trick. Thanks for the advice! This will let the designers easily do what they want with out having too big an issue.

I used this as a helper if all the charactors that could have an issue. http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.