Bill Moseley wrote:
> I'm wondering if TT keeps track of the current column position in the
> line so I can figure out the indent automatically inside a filter.
>
> Some stuff: [% long_text | email_wrap %]
> other: [% more_long_text | email_wrap %]
>
> and automatically wrap to column 17.
If the current state output buffer were available (via the context, for
example), a filter could do something like:
my ($whitespace) = ($output =~ /(\s*)^/);
my $last_indent = ( split /\n/, $whitespace )[-1];
$content =~ s/\n/$last_indent\n/g;
Unfortunately, I think the output buffer is local to the compiled
template, and not referenced by any TT system objects. Maybe TT3 could
incorporate this concept? It sure would be nice to be able to have
INCLUDEd/PROCESSed blocks/files indent nicely...
Jason
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates