add lacunose witnesses to html rendering
Tara L Andrews [Mon, 3 Oct 2011 22:05:50 +0000 (00:05 +0200)]
TreeOfTexts/root/src/index.tt
lib/Text/Tradition/Analysis.pm

index 39c7a0f..3c301c0 100644 (file)
@@ -26,7 +26,7 @@
         <tr [% rowclass %]>
           <th><span class="rowid">[% row.id %]</span></th>
 [% FOREACH reading IN row.readings -%]
-          <td class="clickable"><span onclick="color_nodes($(this).parent().index(), [% reading.group %]);">[% reading.text %]</span></td>
+          <td class="clickable"><span onclick="color_nodes($(this).parent().index(), [% reading.group %], [% reading.missing %]);">[% reading.text %]</span></td>
 [% END -%]
 [% FILTER repeat( row.empty ) -%]
           <td/>
index bdae9a5..7d1c7aa 100644 (file)
@@ -60,13 +60,19 @@ sub run_analysis {
                my $rdg_wits = {};
                my $col_rdgs = shift @$all_wits_table;
                my $rank;
+               my $lacunose = [];
                foreach my $j ( 0 .. $#{$col_rdgs} ) {
                        my $rdg = $col_rdgs->[$j];
                        my $rdg_text = '(omitted)';  # Initialize in case of empty reading
                        if( $rdg ) {
-                               $rdg_text = $rdg->is_lacuna ? undef : $rdg->text; # Don't count lacunae
-                               # Get the rank from any real reading; they should be identical.
-                               $rank = $rdg->rank unless $rank || $rdg->is_lacuna;
+                           if( $rdg->is_lacuna ) {
+                               $rdg_text = undef;   # Don't count lacunae
+                               push( @$lacunose, $col_wits->[$j] );
+                           } else {
+                               $rdg_text = $rdg->text; 
+                                   # Get the rank from any real reading; they should be identical.
+                                   $rank = $rdg->rank;
+                               }
                        }
                        if( defined $rdg_text ) {
                                # Initialize the witness array if we haven't got one yet
@@ -102,7 +108,9 @@ sub run_analysis {
                $variant_row->{'genealogical'} = keys %$sc ? 1 : undef;
                foreach my $grp ( sort keys %$group_readings ) {
                        my $rdg = $group_readings->{$grp};
-                       push( @{$variant_row->{'readings'}}, { 'text' => $rdg, 'group' => $grp } );
+                       push( @{$variant_row->{'readings'}}, 
+                             { 'text' => $rdg, 'group' => $grp,
+                               'missing' => wit_stringify( $lacunose ) } );
                }
                
                # Now run the same analysis given the calculated distance tree(s).