[Koha-bugs] [Bug 20657] Globally enable PRE_CHOMP and POST_CHOMP in Template Toolkit configuration

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 8 09:11:16 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20657

Jonathan Druart <jonathan.druart+koha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.druart+koha at gmail.
                   |                            |com

--- Comment #1 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
I've suggested that yesterday:

diff --git a/C4/Templates.pm b/C4/Templates.pm
index 789495f3fae..7f7b36e3dc6 100644
--- a/C4/Templates.pm
+++ b/C4/Templates.pm
@@ -72,6 +72,9 @@ sub new {
             INCLUDE_PATH => \@includes,
             FILTERS => {},
             ENCODING => 'UTF-8',
+            PRE_CHOMP => 3,
+            POST_CHOMP => 3,
+            TRIM => 1,
         }
     ) or die Template->error();
     my $self = {
@@ -126,6 +129,8 @@ sub output {
     binmode( STDOUT, ":encoding(UTF-8)" );
     $template->process( $self->filename, $vars, \$data )
       || die "Template process failed: ", $template->error();
+
+    $data =~ tr/ //s;
     return $data;
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list