Garry Heaton <[EMAIL PROTECTED]> writes:

> The HTML pages produced by a template I have just coded come with 10
> lines of whitespace at the top before the DOCTYPE declaration. Any
> reason why? Here are my components:
>
> **************** wrapper **********************
>
> [%- WRAPPER html;
>       WRAPPER layout;
>         content;
>       END;
>     END
> -%]

I guess that your "real" wrapper does not start with an empty line?  I
just tried to reproduce your example with tpage (without empty lines)
and can not reproduce your problem.  My output starts immediately with
<DOCTYPE...

Strange.

But when reproducing it I ran into a couple of errors because 'logo',
'nav', 'nonav', and 'footer' were not defined.  This brought me an idea:
Perhaps you PREPROCESS a template in which you define all these blocks?
And perhaps, for better readability, you separate the blocks in this
template with empty lines?  This sounds familiar....

I had the same problems with pre-processing stuff which declared blocks,
macros, and all sorts of other useful stuff but was not designed to
print anything.  Nevertheless the empty lines in such templates get
through - after all, they are just "text".

Call it a dirty solution if you want - but my method to fix this is to
simply put a plain

[% CLEAR %]

at the end of every template file which is not designed to output
anything.  This enables me to write extensive comments between the block
declarations, without even having to use TT comment syntax.
-- 
HTH,
haj


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to