X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FLaTeX.pm;h=c76b82a6274067af448d9360c54bd30a6140628a;hb=833f083eae2a4547c49f8f92a2fdca6ba4dfe5f4;hp=23e2ed0aeaa1456dfe4334fb6741fe33c6256960;hpb=a4c6c83d27a9613e0fec95159988d16cdbe2782d;p=kivitendo-erp.git diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index 23e2ed0ae..c76b82a62 100644 --- a/SL/Template/LaTeX.pm +++ b/SL/Template/LaTeX.pm @@ -72,8 +72,10 @@ sub _format_html { $content =~ s{ \r+ }{}gx; $content =~ s{ \n+ }{ }gx; $content =~ s{ (?:\ |\s)+ }{ }gx; + $content =~ s{ (?:\ |\s)+$ }{}gx; + $content =~ s{ (?:
)+$ }{}gx; - my @parts = map { + my @parts = grep { $_ } map { if (substr($_, 0, 1) eq '<') { s{ +}{}g; $html_replace{$_} || ''; @@ -83,7 +85,10 @@ sub _format_html { } } split(m{(<.*?>)}x, $content); - return join('', @parts); + $content = join '', @parts; + $content =~ s{ (?: [\n\s] | \\newline )+$ }{}gx; + + return $content; } my %formatters = ( @@ -589,7 +594,7 @@ sub parse_and_create_pdf { my $error; eval { - my $template = SL::Template::LaTeX->new($template_file_name, $local_form, \%::myconfig, $::lx_office_conf{paths}->{userspath}); + my $template = SL::Template::LaTeX->new(file_name => $template_file_name, form => $local_form); my $result = $template->parse($tex_fh) && $template->convert_to_pdf; die $template->{error} unless $result;