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

loom.io: messed escaping in attributes #74

Open
vtzi opened this issue Sep 24, 2015 · 2 comments
Open

loom.io: messed escaping in attributes #74

vtzi opened this issue Sep 24, 2015 · 2 comments

Comments

@vtzi
Copy link

vtzi commented Sep 24, 2015

The problem happens when an attribute key or value is a collection and has items requiring escaping. Here is small snippet to reproduce it:

(gv/view (-> (gg/graph [1 2]) (ga/add-attr-to-edges :a ["AA."bb""] [[1 2]])))

The problem is in dot-attrs function. str on collection escapes it:
user> (str ["AA."bb""])
"["AA.\"bb\""]"

I guess dot-attrs should be fully reworked somehow

@danielcompton
Copy link
Contributor

@vtzi can you explain what output you were expecting?

(str ["AA.\"bb\""])
=> "[\"AA.\\\"bb\\\"\"]"
(println "[\"AA.\\\"bb\\\"\"]")
["AA.\"bb\""]
=> nil

This looks like normal Clojure escaping to me?

@vtzi
Copy link
Author

vtzi commented Sep 25, 2015

@danielcompton the output of str is fine. the problem is that loom.io/dot-esc does not escape backslashes and graphviz gets really confused.

Escaping the backslash fixes the issue:

(defn- dot-esc [s](escape s {\ "\" " """ newline "\n"}))

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