in reply to how to chomp or trim extra characters like \n ,white spaces in text area using template toolkit
You can either use pre/post-chomping in your directives, as in:
[% FOREACH option = element.value %] [%- option -%] [% END %] # this is equivalent to writing those three directives on a single lin +e: # [% FOREACH option = element.value %][% option %][% END %]
or you can use global options when you create your new Template object if you want such a behaviour applied everywhere:
my $template = Template->new( { PRE_CHOMP => 1, POST_CHOMP => 1, } );
You can read more about those options in the Template::Manual::Config doc.
|
|---|