X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FStemma.pm;h=24d9e8442c3bc26d14141fe90c49f4fb2e738700;hb=88a6bac5ee5b38c4544a0cb58b67f8ee37b8b023;hp=186a57611916569048c069409fc91519acaf69d7;hpb=f00cefe8896fd0f118dea165da64e9f178ee645b;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Stemma.pm b/lib/Text/Tradition/Stemma.pm index 186a576..24d9e84 100644 --- a/lib/Text/Tradition/Stemma.pm +++ b/lib/Text/Tradition/Stemma.pm @@ -204,14 +204,17 @@ sub as_dot { return join( "\n", @dotlines ); } -=head2 editable +=head2 editable( $linesep ) -Returns a version of the graph rendered in our definition format. +Returns a version of the graph rendered in our definition format. The +$linesep argument defaults to newline; set it to the empty string or to +a space if the result is to be sent via JSON. =cut sub editable { my $self = shift; + my $join = shift || "\n"; my @dotlines; push( @dotlines, 'digraph stemma {' ); my @real; # A cheap sort @@ -233,7 +236,7 @@ sub editable { push( @dotlines, " $from -> $to;" ); } push( @dotlines, '}' ); - return join( "\n", @dotlines ); + return join( $join, @dotlines ); } sub _make_dotline {