Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

Report information
The Basics
Id: 8917
Status: resolved
Priority: 0/
Queue: GraphViz

People
Owner: Nobody in particular
Requestors: Patrice.Dehais [...] toulouse.inra.fr
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.01
Fixed in: (no value)



Subject: HTML-Like labels not well supported
GraphViz.pm version 2.01 perl, v5.8.0 built for i386-linux-thread-multi linux 2.4.20-31.9 RedHat 9 given a graph $g, the following instruction $g->add_node('GOroot', label => '<<FONT COLOR=red>root</FONT>>', shape => 'plaintext'); should produce something like: graph test { GOroot [label=<<font color="red">root</font>>, shape="plaintext"]; } With the latest version of GraphViz.pm (2.01), we have: graph test { GOroot [label="\<\<font color=\"red\"\>root\</font\>\>", shape="plaintext"]; } Several problems can be noticed: * characters < and > should not be escaped * the label value should not be between double quotes I've change two lines in GraphViz.pm to correct this: * to avoid unwanted escape in case of plaintext node shape with HTML-Like labels: in add_node: $node->{label} =~ s#([|<>\[\]{}"])#\\$1#g unless $node->{shape} && $node->{shape} eq 'record'; becomes: $node->{label} =~ s#([|<>\[\]{}"])#\\$1#g unless $node->{shape} && ($node->{shape} eq 'record' || ($node->{label} =~ /^<</ && $node->{shape} eq 'plaintext')); * to avoid double quotes for these paticular labels: in the _attributes function: $value = '"' . $value . '"'; becomes: $value = '"' . $value . '"' unless ($key eq 'label' && $value =~ /^<</); It seems to work, but perhaps isn't it the best way to solve the problem ?
Thanks, this will be fixed in the soon-to-be-released next version.