X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FLaTeX.pm;h=02ad317615628ff3bb1a2421214b954de0f5e08b;hb=29185b688ec990bdb801cd8736a12c403095db0c;hp=c515187cef7696d82ff898d5509d8dd195d25ce8;hpb=97c8f14b3fea88e6b482919d944cb8e6461bc451;p=kivitendo-erp.git diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index c515187ce..02ad31761 100644 --- a/SL/Template/LaTeX.pm +++ b/SL/Template/LaTeX.pm @@ -4,6 +4,9 @@ use parent qw(SL::Template::Simple); use strict; +use Cwd; +use Unicode::Normalize qw(); + sub new { my $type = shift; @@ -14,7 +17,6 @@ sub new { sub format_string { my ($self, $variable) = @_; - my $form = $self->{"form"}; $variable = $main::locale->quote_special_chars('Template/LaTeX', $variable); @@ -55,11 +57,12 @@ sub parse_foreach { for (my $i = 0; $i < scalar(@{$ary}); $i++) { # do magic markers - $form->{"__first__"} = $i == 1; + $form->{"__first__"} = $i == 0; $form->{"__last__"} = ($i + 1) == scalar(@{$ary}); $form->{"__odd__"} = (($i + 1) % 2) == 1; $form->{"__counter__"} = $i + 1; + #everything from here to the next marker should be removed after the release of 2.7.0 if ( ref $description_array eq 'ARRAY' && scalar @{$description_array} == scalar @{$ary} && $self->{"chars_per_line"} != 0) @@ -100,6 +103,7 @@ sub parse_foreach { } $current_line += $lines; } + #stop removing code here. if ( ref $linetotal_array eq 'ARRAY' && $i < scalar(@{$linetotal_array})) { @@ -132,7 +136,7 @@ sub find_end { my $keyword_pos = $pos - 1 + $tag_start_len; - if ((substr($text, $keyword_pos, 2) eq 'if') || (substr($text, $keyword_pos, 3) eq 'for')) { + if ((substr($text, $keyword_pos, 2) eq 'if') || (substr($text, $keyword_pos, 7) eq 'foreach')) { $depth++; } elsif ((substr($text, $keyword_pos, 4) eq 'else') && (1 == $depth)) { @@ -252,6 +256,9 @@ sub _parse_config_option { if ($key eq 'tag-style') { $self->set_tag_style(split(m/\s+/, $value, 2)); } + if ($key eq 'use-template-toolkit') { + $self->set_use_template_toolkit($value); + } } sub _parse_config_lines { @@ -264,7 +271,7 @@ sub _parse_config_lines { $comment_start = '\s*%'; } elsif (ref $self eq 'SL::Template::HTML') { $comment_start = '\s*