Revision e36cc2a6
Von Moritz Bunkus vor fast 13 Jahren hinzugefügt
SL/Template/LaTeX.pm | ||
---|---|---|
63 | 63 |
$form->{"__odd__"} = (($i + 1) % 2) == 1; |
64 | 64 |
$form->{"__counter__"} = $i + 1; |
65 | 65 |
|
66 |
if ( ref $description_array eq 'ARRAY' |
|
67 |
&& scalar @{$description_array} == scalar @{$ary} |
|
68 |
&& $self->{"chars_per_line"} != 0) |
|
69 |
{ |
|
70 |
my $lines = int(length($description_array->[$i]) / $self->{"chars_per_line"}); |
|
71 |
my $lpp; |
|
72 |
|
|
73 |
$description_array->[$i] =~ s/(\\newline\s?)*$//; |
|
74 |
$lines++ while ($description_array->[$i] =~ m/\\newline/g); |
|
75 |
$lines++; |
|
76 |
|
|
77 |
if ($current_page == 1) { |
|
78 |
$lpp = $self->{"lines_on_first_page"}; |
|
79 |
} else { |
|
80 |
$lpp = $self->{"lines_on_second_page"}; |
|
81 |
} |
|
82 |
|
|
83 |
# Yes we need a manual page break -- or the user has forced one |
|
84 |
if ( (($current_line + $lines) > $lpp) |
|
85 |
|| ($description_array->[$i] =~ /<pagebreak>/) |
|
86 |
|| ( ref $longdescription_array eq 'ARRAY' |
|
87 |
&& $longdescription_array->[$i] =~ /<pagebreak>/)) { |
|
88 |
my $pb = $self->{"pagebreak_block"}; |
|
89 |
|
|
90 |
# replace the special variables <%sumcarriedforward%> |
|
91 |
# and <%lastpage%> |
|
92 |
|
|
93 |
my $psum = $form->format_amount($self->{"myconfig"}, $sum, 2); |
|
94 |
$pb =~ s/$self->{tag_start_qm}sumcarriedforward$self->{tag_end_qm}/$psum/g; |
|
95 |
$pb =~ s/$self->{tag_start_qm}lastpage$self->{tag_end_qm}/$current_page/g; |
|
96 |
|
|
97 |
my $new_text = $self->parse_block($pb, (@indices, $i)); |
|
98 |
return undef unless (defined($new_text)); |
|
99 |
$new_contents .= $new_text; |
|
100 |
|
|
101 |
$current_page++; |
|
102 |
$current_line = 0; |
|
103 |
} |
|
104 |
$current_line += $lines; |
|
105 |
} |
|
106 |
|
|
107 | 66 |
if ( ref $linetotal_array eq 'ARRAY' |
108 | 67 |
&& $i < scalar(@{$linetotal_array})) { |
109 | 68 |
$sum += $form->parse_amount($self->{"myconfig"}, $linetotal_array->[$i]); |
... | ... | |
336 | 295 |
|
337 | 296 |
my $contents = join("", @lines); |
338 | 297 |
|
339 |
# detect pagebreak block and its parameters |
|
340 |
if ($contents =~ /$self->{tag_start_qm}pagebreak\s+(\d+)\s+(\d+)\s+(\d+)\s*$self->{tag_end_qm}(.*?)$self->{tag_start_qm}end(\s*pagebreak)?$self->{tag_end_qm}/s) { |
|
341 |
$self->{"chars_per_line"} = $1; |
|
342 |
$self->{"lines_on_first_page"} = $2; |
|
343 |
$self->{"lines_on_second_page"} = $3; |
|
344 |
$self->{"pagebreak_block"} = $4; |
|
345 |
|
|
346 |
substr($contents, length($`), length($&)) = ""; |
|
347 |
} |
|
348 |
|
|
349 |
$self->{"forced_pagebreaks"} = []; |
|
350 |
|
|
351 | 298 |
my $new_contents = $self->parse_block($contents); |
352 | 299 |
if (!defined($new_contents)) { |
353 | 300 |
$main::lxdebug->leave_sub(); |
Auch abrufbar als: Unified diff
pagebreak-Mechanismus entfernen
Fix für Bug 1733.