What is the difference between [% %]
and [%- -%]
in Template Toolkit?
Asked
Active
Viewed 1,223 times
5

ThisSuitIsBlackNot
- 23,492
- 9
- 63
- 110

Gaurav Rathi
- 93
- 10
1 Answers
10
The -
automatically removes some whitespace from before/after the directive tag.
You can add
-
or+
to the immediate start or end of a directive tag to control the whitespace chomping options. See thePRE_CHOMP
andPOST_CHOMP
options for further details.
See Template::Manual::Config for good examples of the effects with and without pre and post chomping.

Sinan Ünür
- 116,958
- 15
- 196
- 339

ysth
- 96,171
- 6
- 121
- 214
-
And although it is not remotely related to chomping, I like to use [%- -%] because it aligns very nicely with 4-space tab expansion :-) – RET Mar 24 '15 at 06:33