# See if we can get better overall alignment by removing some high level
# (deep) matches. We can skip this call if there are none.
- prune_alignment_tree($rlines) if ( $max_lev_diff >= 1 );
+ # Modified to send all lines through so that good breakpoints
+ # can be located.
+ prune_alignment_tree($rlines); ## if ( $max_lev_diff >= 1 );
# See if we can get better overall alignment by removing some
# ending alignment tokens of ragged lists.
my @delete_list;
my %end_group;
- my $starting_depth = 0; # normally 0 except for debugging
+ # Define a threshold line count for forcing a break
+ my $nlines_break = 3;
# We work with a list of nodes to visit at the next deeper depth.
my @todo_list;
- if ( defined( $match_tree[$starting_depth] ) ) {
- @todo_list = ( 0 .. @{ $match_tree[$starting_depth] } - 1 );
+ if ( defined( $match_tree[0] ) ) {
+ @todo_list = ( 0 .. @{ $match_tree[0] } - 1 );
}
- for ( my $depth = $starting_depth ; $depth < $MAX_DEPTH ; $depth++ ) {
+ for ( my $depth = 0 ; $depth <= $MAX_DEPTH ; $depth++ ) {
last unless (@todo_list);
my @todo_next;
foreach my $np (@todo_list) {
$rindexes_p )
= @{ $match_tree[$depth]->[$np] };
+ # Set a break before this block if it has significant size.
+ # Eventually this could become unnecessary if the final alignment
+ # phase logic improves, but for now this insures that significant
+ # alignment changes are not missed. See test 'align33.in'.
+ my $nlines_p = $jend_p - $jbeg_p + 1;
+ if ( $jbeg_p > 1
+ && $nlines_p > $nlines_break
+ && !$rlines->[$jbeg_p]->{_is_hanging_side_comment} )
+ {
+ $rlines->[ $jbeg_p - 1 ]->{_end_group} = 1;
+ }
+
# nothing to do if no children
next unless defined($nc_beg_p);
# So we will use two thresholds.
my $nmin_mono = $depth + 3;
my $nmin_non_mono = $depth + 6;
- my $nlines_p = $jend_p - $jbeg_p + 1;
if ( $nmin_mono > $nlines_p - 1 ) {
$nmin_mono = $nlines_p - 1;
}
}
# loop to keep or delete each child node
- my $jend_c_keep;
foreach my $nc ( $nc_beg_p .. $nc_end_p ) {
my ( $jbeg_c, $jend_c, $np_c, $lev_c, $pat_c, $nc_beg_c,
$nc_end_c )
push @delete_list, [ $jbeg_c, $jend_c, $lev_p ];
}
else {
- if ( defined($jend_c_keep) && $jbeg_c == $jend_c_keep + 1 )
- {
- $rlines->[$jend_c_keep]->{_end_group} = 1;
- }
- $jend_c_keep = $jend_c;
push @todo_next, $nc;
}
}
--- /dev/null
+$wl = int( $wl * $f + .5 );
+$wr = int( $wr * $f + .5 );
+$pag = int( $pageh * $f + .5 );
+$fe = $opt_F ? "t" : "f";
+$cf = $opt_U ? "t" : "f";
+$tp = $opt_t ? "t" : "f";
+$rm = $numbstyle ? "t" : "f";
+$pa = $showurl ? "t" : "f";
+$nh = $seq_number ? "t" : "f";
--- /dev/null
+$wl = int( $wl * $f + .5 );
+$wr = int( $wr * $f + .5 );
+$pag = int( $pageh * $f + .5 );
+$fe = $opt_F ? "t" : "f";
+$cf = $opt_U ? "t" : "f";
+$tp = $opt_t ? "t" : "f";
+$rm = $numbstyle ? "t" : "f";
+$pa = $showurl ? "t" : "f";
+$nh = $seq_number ? "t" : "f";
#4 sot.def
#5 sot.sot
#6 prune.def
+#7 align33.def
# To locate test #13 you can search for its name or the string '#13'
############################
$rsources = {
+ 'align33' => <<'----------',
+$wl = int( $wl * $f + .5 );
+$wr = int( $wr * $f + .5 );
+$pag = int( $pageh * $f + .5 );
+$fe = $opt_F ? "t" : "f";
+$cf = $opt_U ? "t" : "f";
+$tp = $opt_t ? "t" : "f";
+$rm = $numbstyle ? "t" : "f";
+$pa = $showurl ? "t" : "f";
+$nh = $seq_number ? "t" : "f";
+----------
+
'lop' => <<'----------',
# logical padding examples
$same =
];
#6...........
},
+
+ 'align33.def' => {
+ source => "align33",
+ params => "def",
+ expect => <<'#7...........',
+$wl = int( $wl * $f + .5 );
+$wr = int( $wr * $f + .5 );
+$pag = int( $pageh * $f + .5 );
+$fe = $opt_F ? "t" : "f";
+$cf = $opt_U ? "t" : "f";
+$tp = $opt_t ? "t" : "f";
+$rm = $numbstyle ? "t" : "f";
+$pa = $showurl ? "t" : "f";
+$nh = $seq_number ? "t" : "f";
+#7...........
+ },
};
my $ntests = 0 + keys %{$rtests};