From: Tara L Andrews Date: Fri, 4 May 2012 14:04:44 +0000 (+0200) Subject: fix dot/SVG output for (sub)start/end nodes and their IDs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=43c9434136e6ceea427503a81013461f364e2485;p=scpubgit%2Fstemmatology.git fix dot/SVG output for (sub)start/end nodes and their IDs --- diff --git a/lib/Text/Tradition/Collation.pm b/lib/Text/Tradition/Collation.pm index 63daec7..17e4394 100644 --- a/lib/Text/Tradition/Collation.pm +++ b/lib/Text/Tradition/Collation.pm @@ -642,15 +642,15 @@ sub as_dot { # Output substitute start/end readings if necessary if( $startrank ) { - $dot .= "\t\"#SUBSTART#\" [ label=\"...\",id=\"__SUBSTART__\" ];\n"; + $dot .= "\t\"__SUBSTART__\" [ label=\"...\",id=\"__START__\" ];\n"; } if( $endrank ) { - $dot .= "\t\"#SUBEND#\" [ label=\"...\",id=\"__SUBEND__\" ];\n"; + $dot .= "\t\"__SUBEND__\" [ label=\"...\",id=\"__END__\" ];\n"; } if( $STRAIGHTENHACK ) { ## HACK part 1 - my $startlabel = $startrank ? 'SUBSTART' : 'START'; - $dot .= "\tsubgraph { rank=same \"#$startlabel#\" \"#SILENT#\" }\n"; + my $startlabel = $startrank ? '__SUBSTART__' : '__START__'; + $dot .= "\tsubgraph { rank=same \"$startlabel\" \"#SILENT#\" }\n"; $dot .= "\t\"#SILENT#\" [ shape=diamond,color=white,penwidth=0,label=\"\" ];" } my %used; # Keep track of the readings that actually appear in the graph @@ -722,18 +722,18 @@ sub as_dot { my $witstr = $self->_path_display_label ( $self->reading_witnesses( $self->reading( $node ) ) ); my $variables = { %edge_attrs, 'label' => $witstr }; my $varopts = _dot_attr_string( $variables ); - $dot .= "\t\"#SUBSTART#\" -> \"$node\" $varopts;"; + $dot .= "\t\"__SUBSTART__\" -> \"$node\" $varopts;"; } foreach my $node ( keys %subend ) { my $witstr = $self->_path_display_label ( $self->reading_witnesses( $self->reading( $node ) ) ); my $variables = { %edge_attrs, 'label' => $witstr }; my $varopts = _dot_attr_string( $variables ); - $dot .= "\t\"$node\" -> \"#SUBEND#\" $varopts;"; + $dot .= "\t\"$node\" -> \"__SUBEND__\" $varopts;"; } # HACK part 2 if( $STRAIGHTENHACK ) { - my $endlabel = $endrank ? 'SUBEND' : 'END'; - $dot .= "\t\"#$endlabel#\" -> \"#SILENT#\" [ color=white,penwidth=0 ];\n"; + my $endlabel = $endrank ? '__SUBEND__' : '__END__'; + $dot .= "\t\"$endlabel\" -> \"#SILENT#\" [ color=white,penwidth=0 ];\n"; } $dot .= "}\n";