loom.io: messed escaping in attributes
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
@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?
@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"}))