Ttreerc: PRECHOMP = 1, POSTCHOMP =1
which I interpret as whitespace is only added if I ask for it.
If I have a template
[% BUNCH of DIRECTIVES %]
[% NOTHER BUNCH %]
Then with this setting I would expect there to be no output of
whitespace.
IF however the blank line between the two blocks has one or more
tab characters, then the tab is output. If there are two blank
lines, and they both have tabs I get tab newline tab.
This is counter intuitive.
**********
Consider the following block: (Orignially produced in gvim
with ts=2, tabs collapsed to 2 space here to improve readability.)
[% BLOCK makelink %]
[% class = '' ;
linkname = page.lname ;
truepath = page.path ;
IF page.df == 'd' ;
link = page.path _ '/' _ page.fname _ '.html' ;
ELSE ;
link = page.path;
END ; #if then else
%]
[% link +%]
[%+ END %]
IF either plus at the brackets is eliminated, then
I get one mongo blob of text.
Obviously I don't understand TT2 and whitespace.
So, Go Ask the Badger.
! DING ! Enlightenment. The space between things can be
chomped by chompers at either end. So to preserve any white
space, with PRE and POST both operating, you need two adjacent
brackets to have +'s.
Let's see: How do I prefer to have it.
In perl I'm used to putting a newline at the end of the line.
So I would prefer the syntax [% foo +%] to finish the line.
Set PRECHOMP = 0, POSTCHOMP to 1
Try that. Hmm. Now I've got a blank line at the top of my list
and every line of output has a leading tab. Now I'm confused.
Ok. General tips for managing white space?
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates