move scripts where they belong
[scpubgit/stemmatology.git] / script / svg_from_csv.pl
CommitLineData
5f5e51a5 1#!/usr/bin/perl
dd3b58b0 2
3use lib 'lib';
4use strict;
5use warnings;
e2902068 6use Text::Tradition;
dd3b58b0 7
5f5e51a5 8# First: read the base. Make a graph, but also note which
9# nodes represent line beginnings.
10
11my $tradition = Text::Tradition->new(
12 'CSV' => $ARGV[0],
13 'base' => $ARGV[1],
14 );
15
16
17print $tradition->collation->as_svg();
18print STDERR "DONE\n";
19__END__
20my $rows = 0;
21my $matrix = [];
22foreach my $pos ( $collation_graph->{'positions'}->all ) {
23 my @p_nodes = $collation_graph->{'positions'}->nodes_at_position( $pos );
24 $rows = scalar @p_nodes
25 if $rows < scalar @p_nodes;
26 push( @$matrix, \@p_nodes );
27}
28print "<html><head><title>A table</title></head><body><table>\n";
29foreach my $i ( 0 .. $rows-1 ) {
30 print "\t<tr>\n";
31 foreach my $col( @$matrix ) {
32 my $str = '';
33 if( $col->[$i] ) {
34 $str = $collation_graph->node( $col->[$i] )->label;
35 }
36 printf( "\t\t<td>%s</td>\n", $str );
37 }
38 print "\t</tr>\n";
39}
40print "</table></body></html>\n";
41
dd3b58b0 42