[Templates] getting rid of auto ident

Fagyal Csongor concept@conceptonline.hu
Fri, 17 Nov 2006 15:44:24 +0100


Hi,

To sum it up, I have some trouble when TT compiles my templates and stores them on disk, as it automatically idents the blocks which breaks my code.

This is not what I am having, but for the sake of simplicity, imagine something like this:

...
[% PERL %]
my $xxx = <<__ZOH__;
adsfadsf
asdfasdf
asdfdasf
__ZOH__
...
[% END %]
...

Which is then turned into something like this:


Template::Document->new({
    METADATA => {
        'modtime' => '1163773828',
        'name' => '/home/www/.......comp',
    },
    BLOCK => sub {
        my $context = shift || die "template sub called without context\n";
        my $stash   = $context->stash;
        my $output  = '';
        my $error;

        eval { BLOCK: {
    $output .=  $context->process('__admin/header.tem');
    $output .=  "\n\n\n<div style=\"background:rgb(255,240,250)\">\nSelect page to edit:\n<form method=\"get\">\n";

.... and so on...

	my $xxx = <<__ZOH__;
	adsfadsf
	asdfasdf
	asdfdasf
	__ZOH__

Which obviously won't work, because of the whitespaces before the closing __ZOH__.


Is there a way to bypass this behaviour? (And not only for PERL blocks...)

Thanx,
- Fagzal