$r += 500;
}
$c->stash->{'textsegments'} = [];
- foreach my $start ( @divs ) {
- my $seg = { 'start' => $start };
- $seg->{'end'} = $start + 550 > $length ? $length : $start + 550;
+ foreach my $i ( 0..$#divs ) {
+ my $seg = { 'start' => $divs[$i] };
+ $seg->{'display'} = "Segment " . ($i+1);
push( @{$c->stash->{'textsegments'}}, $seg );
}
}
+ $DB::single = 1;
$c->stash->{'textid'} = $textid;
$c->stash->{'tradition'} = $tradition;
}
my $collation = $tradition->collation;
my $svgopts;
if( $startseg ) {
- # Only render the subgraph from startseg to +500 or end,
+ # Only render the subgraph from startseg to +550 or end,
# whichever is less.
$svgopts = { 'from' => $startseg };
$svgopts->{'to'} = $startseg + 550
} elsif( exists $c->stash->{'textsegments'} ) {
# This is the unqualified load of a long tradition. We implicitly start
# at zero, but go only as far as 550.
+ $startseg = 0;
$svgopts = { 'to' => 550 };
}
my $svg_str = $collation->as_svg( $svgopts );
$svg_str =~ s/\n//gs;
+ $c->stash->{'startseg'} = $startseg if defined $startseg;
$c->stash->{'svg_string'} = $svg_str;
$c->stash->{'text_title'} = $tradition->name;
$c->stash->{'template'} = 'relate.tt';
<h2>[% text_title %]</h2>
<div id="segmentation">
[% FOREACH segment IN textsegments -%]
+[% IF segment.start != startseg -%]
<a href="[% c.uri_for( "/relation/$textid" ) %]?start=[% segment.start %]">
- <span class="segment_guide">[% segment.start %] – [% segment.end %]</span>
+ <span class="segment_guide">[% segment.display %]</span>
</a>
+[% ELSE -%]
+ <span class="segment_guide selected">[% segment.display %]</span>
+[% END -%]
[% END -%]
</div>
</div>