From: tla Date: Wed, 25 May 2011 08:59:12 +0000 (+0200) Subject: Merge branch 'moose' of github.com:tla/stemmatology into moose X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a87c42dcf41f90370677e806604a5315cb1658b3;p=scpubgit%2Fstemmatology.git Merge branch 'moose' of github.com:tla/stemmatology into moose Conflicts: script/svg_from_csv.pl --- a87c42dcf41f90370677e806604a5315cb1658b3 diff --cc script/svg_from_csv.pl index 3a27521,7a154c4..3907ca6 --- a/script/svg_from_csv.pl +++ b/script/svg_from_csv.pl @@@ -5,10 -5,38 +5,36 @@@ use strict use warnings; use Text::Tradition; - my $tradition = Text::Tradition->new( - 'CSV' => $ARGV[0], - 'base' => $ARGV[1], - ); + # First: read the base. Make a graph, but also note which + # nodes represent line beginnings. + + my $tradition = Text::Tradition->new( + 'CSV' => $ARGV[0], + 'base' => $ARGV[1], + ); + print $tradition->collation->as_svg(); - print STDERR "Done\n"; + print STDERR "DONE\n"; + __END__ + my $rows = 0; + my $matrix = []; + foreach my $pos ( $collation_graph->{'positions'}->all ) { + my @p_nodes = $collation_graph->{'positions'}->nodes_at_position( $pos ); + $rows = scalar @p_nodes + if $rows < scalar @p_nodes; + push( @$matrix, \@p_nodes ); + } + print "A table\n"; + foreach my $i ( 0 .. $rows-1 ) { + print "\t\n"; + foreach my $col( @$matrix ) { + my $str = ''; + if( $col->[$i] ) { + $str = $collation_graph->node( $col->[$i] )->label; + } + printf( "\t\t\n", $str ); + } + print "\t\n"; + } + print "
%s
\n"; - -