Skip to content

Instantly share code, notes, and snippets.

@hdp
Created June 10, 2011 13:06
Show Gist options
  • Save hdp/1018796 to your computer and use it in GitHub Desktop.
Save hdp/1018796 to your computer and use it in GitHub Desktop.
diff --git a/lib/GraphViz.pm b/lib/GraphViz.pm
index 549c1fd..f69bb58 100644
--- a/lib/GraphViz.pm
+++ b/lib/GraphViz.pm
@@ -1124,17 +1124,12 @@ sub _as_debug {
$cluster->{label} = $name;
delete $cluster->{name};
}
- $attrs = _attributes($cluster);
+ $attrs = _attributes($cluster, for_cluster => 1);
} else {
$name = $cluster;
- $attrs = _attributes( { label => $cluster } );
+ $attrs = _attributes( { label => $cluster }, for_cluster => 1 );
}
- # rewrite attributes string slightly
- $attrs =~ s/^\s\[//o;
- $attrs =~ s/,/;/go;
- $attrs =~ s/\]$//o;
-
$dot .= "\tsubgraph cluster_" . $self->_quote_name($name) . " {\n";
$dot .= "\t\t$attrs;\n";
$dot .= join "", map {
@@ -1231,6 +1226,7 @@ sub _quote_name {
sub _attributes {
my $thing = shift;
+ my %opt = @_;
my @attributes;
@@ -1249,6 +1245,7 @@ sub _attributes {
}
if (@attributes) {
+ return join("; ", sort @attributes) if $opt{for_cluster};
return ' [' . ( join ', ', sort @attributes ) . "]";
} else {
return "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment