glejeune/Ruby-Graphviz — Issue #42: escaped dot in label, backslash showing up
Author: nevenh
Created: 2012-02-18 10:35:53+00:00
State: open

Related:

https://github.com/glejeune/Ruby-Graphviz/issues/8
https://github.com/glejeune/Ruby-Graphviz/commit/b2204d908a1254c2520b0cc7ae71720b93c88ae2

Having problem with labels that contain dot, did you ever find out why the escaping was added? Dot should be a valid character in label.

Parsing back generated dot file chokes too:

$ cat sample.rb
require 'graphviz'
g = GraphViz.new(:G, :type => :graph)
g.add_nodes("Hello World.")
puts g.to_s
GraphViz.parse_string(g.to_s)

$ RUBYLIB=lib ruby sample.rb
graph G {
"Hello World\." [label = "Hello World."];
}
./lib/graphviz/dot2ruby.rb:47:in `eval': (eval):8:in `eval': compile error (SyntaxError)
(eval):6: syntax error, unexpected $undefined, expecting '}'
node_hello__world\ = graph_g.add_nodes( "Hello W...
^
from ./lib/graphviz/dot2ruby.rb:55:in `eval_string'
from ./lib/graphviz.rb:784:in `parse_string'
from sample.rb:5

And, sample29 which has a dot in the label is generating:

$ grep '

"Hello\."\nHow are you ?

Thanks.