X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=SL%2FTemplate%2FLaTeX.pm;h=2df7e8cfbc574f9eaea1afdc36324090764aa485;hb=45970e731c7e0c8a3d469a1c344af20c18987c20;hp=c515187cef7696d82ff898d5509d8dd195d25ce8;hpb=6326597dd68e46a2a5414fc63927d7d41a097ab5;p=kivitendo-erp.git diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index c515187ce..2df7e8cfb 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; @@ -55,7 +58,7 @@ 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; @@ -132,7 +135,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)) { @@ -264,7 +267,7 @@ sub _parse_config_lines { $comment_start = '\s*%'; } elsif (ref $self eq 'SL::Template::HTML') { $comment_start = '\s*