Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unescape when creating SVG files #2

Open
maacl opened this issue Mar 9, 2013 · 4 comments
Open

Unescape when creating SVG files #2

maacl opened this issue Mar 9, 2013 · 4 comments

Comments

@maacl
Copy link

maacl commented Mar 9, 2013

Thanks for making dorothy. It is really easy to use. I am currently using it to generate SVG diagrams. In doing so I have trying to embed links in the diagrams. Graphviz of course supports links on nodes and edges, but I need to generate links on for instance a part of a label. To that end I have tried to embed raw svg strings in the label text, but dorothy (graphviz?) escape these. Is there a way to circumvent this behaviour or an alternative way of accomplishing what I am trying to do?

@daveray
Copy link
Owner

daveray commented Mar 10, 2013

Howdy. I'd be happy to add this. Could you give an example of what you're trying to do and the dot output you'd expect to see?

@maacl
Copy link
Author

maacl commented Mar 10, 2013

Dave,

Thanks for looking into this. I have included an example blw.

(-> (digraph [ [:a :b] [:a :c] [:a {:label "A\nSubheading\nAn example link."}] ]) dot (save! "test.dot"
{:format :dot}))

Running this results in the attached test.dot file which looks ok, but when
I run:

(-> (digraph [ [:a :b] [:a :c] [:a {:label "A\nSubheading\nAn example link."}] ]) dot (save! "svg.dot"
{:format :svg}))

it results in the attached test.svg which has the html chars escaped.

I have handedited the attached svg-retrofit.svg to match my expected result.

I realise that this looks like a Graphviz issue, but am hoping you might
see a way around it. It would be much cleaner if I don't have to
post-process the svg to insert the links.

/mac

On Sun, Mar 10, 2013 at 4:45 AM, Dave Ray notifications@github.com wrote:

Howdy. I'd be happy to add this. Could you give an example of what you're
trying to do and the dot output you'd expect to see?


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-14675728
.

@daveray
Copy link
Owner

daveray commented Mar 22, 2013

Hi. Sorry about the delayed reponse. ClojureWest happened :)

I've played around with this a bit and it doesn't seem that there's a way to defeat the escaping of the content in SVG text nodes, at least in part because of this change: http://www.graphviz.org/mantisbt/view.php?id=560

Interestingly, wrapping the label in html tags which should invoke Graphviz's html support causes the text to be completely omitted from the SVG output.

I guess it's understandable in that they might not know how to layout the text of a node when it contains arbitrary markup.

So, I'm not sure what can be done. You could devise some kind of post-processing step, but I'm not sure whether that would give you good results. :(

@maacl
Copy link
Author

maacl commented Mar 22, 2013

Dave,

Thanks for the response and thanks again for looking into this. I agree it
looks difficult.

As much as I hate it will try do some post-processing of the SVG
to achieve the desired effect.

/mac

On Fri, Mar 22, 2013 at 6:01 AM, Dave Ray notifications@github.com wrote:

Hi. Sorry about the delayed reponse. ClojureWest happened :)

I've played around with this a bit and it doesn't seem that there's a way
to defeat the escaping of the content in SVG text nodes, at least in part
because of this change: http://www.graphviz.org/mantisbt/view.php?id=560

Interestingly, wrapping the label in html tags which should invoke
Graphviz's html support causes the text to be completely omitted from the
SVG output.

I guess it's understandable in that they might not know how to layout the
text of a node when it contains arbitrary markup.

So, I'm not sure what can be done. You could devise some kind of
post-processing step, but I'm not sure whether that would give you good
results. :(


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-15281361
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants