diff -ur GraphViz-2.04~/lib/GraphViz.pm GraphViz-2.04/lib/GraphViz.pm
--- GraphViz-2.04~/lib/GraphViz.pm 2008-12-12 21:31:42.000000000 +0000
+++ GraphViz-2.04/lib/GraphViz.pm 2009-12-01 10:36:30.000000000 +0000
@@ -429,6 +429,12 @@
$g->add_node('Paris', label => 'City of\nlurve');
+If a label starts with '<' and ends with '>', then a rudimentary form
+of HTML is used. See
http://www.graphviz.org/doc/info/shapes.html#html
+for details.
+
+ $g->add_node('Paris', label => '<City of<br/>lurve>');
+
Attributes need not all be specified in the one line: successive
declarations of the same node have a cumulative effect, in that any
later attributes are just added to the existing ones. For example, the
@@ -574,11 +580,8 @@
}
} else {
$node->{label} =~ s#([|<>\[\]{}"])#\\$1#g
- unless $node->{shape}
- && ($node->{shape} eq 'record'
- || ( $node->{label} =~ /^<</
- && $node->{shape} eq 'plaintext' )
- );
+ unless ( $node->{shape} && $node->{shape} eq 'record'
+ || $node->{label} =~ /^<.*>$/ );
}
delete $node->{cluster}
@@ -1241,7 +1244,7 @@
my $value = $thing->{$key};
$value =~ s|"|\"|g;
$value = '"' . $value . '"'
- unless ( $key eq 'label' && $value =~ /^<</ );
+ unless ( $key eq 'label' && $value =~ /^<.*>$/ );
$value =~ s|\n|\\n|g;
$value = '""' if not defined $value;
diff -ur GraphViz-2.04~/t/simple.t GraphViz-2.04/t/simple.t
--- GraphViz-2.04~/t/simple.t 2008-12-12 21:30:13.000000000 +0000
+++ GraphViz-2.04/t/simple.t 2009-12-01 10:27:02.000000000 +0000
@@ -4,7 +4,7 @@
use warnings;
use lib '../lib', 'lib';
use GraphViz;
-use Test::More tests => 30;
+use Test::More tests => 31;
my @lines = <DATA>;
@@ -492,3 +492,11 @@
ratio="fill";
GOroot [label=<<FONT COLOR="red">root</FONT>>, shape="plaintext"];
}
+-- test --
+$g = GraphViz->new();
+$g->add_node('html_text', label => '<line one<br/>line two>');
+-- expect --
+digraph test {
+ ratio="fill";
+ html_text [label=<line one<br/>line two>];
+}