HTML label problem

Hi
I want to use some dot files generated for graphviz but I have some parsing
issues.
I am using HTML labels and it seems to cause problems.

Here is my example:
graph G {
  "1" [label=<foo<br/>bar>,shape=box, ];
  "2" [shape=box, ];

  "1" -- "2" [fontcolor="#FF0000",
                                         color="#FF0000", label="2.4e-04",
];
  }

This HTML label ("label=<foo<br/>bar>") causes this error:
Traceback (most recent call last):
  File "community_graph_tool.py", line 47, in <module>
    main(sys.argv[1:])
  File "community_graph_tool.py", line 30, in main
    g = load_graph(idotfile)
  File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line
1956, in load_graph
    g.load(file_name, fmt, ignore_vp, ignore_ep, ignore_gp)
  File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line
1712, in load
    ignore_ep, ignore_gp)
RuntimeError: Wanted right bracket to end attribute list (token is
"<identifier> 'bar'")

If I remove <br/>, I get another error:
Traceback (most recent call last):
  File "community_graph_tool.py", line 47, in <module>
    main(sys.argv[1:])
  File "community_graph_tool.py", line 30, in main
    g = load_graph(idotfile)
  File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line
1956, in load_graph
    g.load(file_name, fmt, ignore_vp, ignore_ep, ignore_gp)
  File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line
1712, in load
    ignore_ep, ignore_gp)
RuntimeError: Unclosed HTML string (at end of input)

And if I completely remove the "label=<foo<br/>bar>,", it also removes all
errors.

Thanks for your work and time.
Johan

attachment.html (2.38 KB)

[...]

This is not valid dot format. Labels must always be quoted. You need to
write:

    graph G {
      "1" [label="<foo<br/>bar>",shape=box];
      ...

Also, I'm not sure if these trailing commas are allowed or not.
Take a look at the format specification at:

     http://www.graphviz.org/pdf/dotguide.pdf

Best,
Tiago

The pdf file that you quote says (2.3 on P9) that:
"In order to allow a richer collection of attributes at a finer
granularity, dot accepts
HTML-like labels using HTML syntax. These are specified using strings that
are
delimited by < . . . > rather than double-quotes."
So, I think that my files are valid.

Furthermore, if you add double-quote around HTML labels, the HTML are not
recognized by graphviz tools such as fdp or neato and the files generated
by these tools use the default labels and not the HTML ones.

Thanks again for your time.
Johan

2014-06-12 22:58 GMT+09:00 Tiago de Paula Peixoto <tiago(a)skewed.de>:

attachment.html (2.31 KB)

You are right, the HTML strings are specifying are valid and should
work. This seems to be a bug in the graphviz reader from Boost, which
is used by graph-tool. You could perhaps file a bug report here:

   http://www.boost.org/development/bugs.html

I'll try to find a workaround in the meantime.

Best,
Tiago

I could file a bug report but I do not really know the lib or how you
actually use it in graph-tool so...
Anyway, I will try to report something.

2014-06-17 0:22 GMT+09:00 Tiago de Paula Peixoto <tiago(a)skewed.de>:

attachment.html (2.04 KB)