From: Tara L Andrews Date: Thu, 20 Sep 2012 14:24:41 +0000 (+0200) Subject: use witness sigil as graph node ID in SVG display X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c753ea405fd479edd0c9d85aa2a6d87f531ce1a0;p=scpubgit%2Fstemmatology.git use witness sigil as graph node ID in SVG display --- diff --git a/analysis/lib/Text/Tradition/Stemma.pm b/analysis/lib/Text/Tradition/Stemma.pm index 0152455..3427029 100644 --- a/analysis/lib/Text/Tradition/Stemma.pm +++ b/analysis/lib/Text/Tradition/Stemma.pm @@ -266,14 +266,11 @@ sub as_dot { # Add each of the nodes. foreach my $n ( $graph->vertices ) { + my %vattr = ( 'id' => $n ); # Set the SVG element ID to the sigil itself if( $graph->has_vertex_attribute( $n, 'label' ) ) { - my $ltext = $graph->get_vertex_attribute( $n, 'label' ); - push( @dotlines, _make_dotline( $n, 'label' => $ltext ) ); - } else { - # Use the default display settings. - $n = _dotquote( $n ); - push( @dotlines, " $n;" ); + $vattr{'label'} = $graph->get_vertex_attribute( $n, 'label' ); } + push( @dotlines, _make_dotline( $n, %vattr ) ); } # Add each of our edges. foreach my $e ( $graph->edges ) {