[Templates] Wrap plugin - current indent
Cees Hek
ceeshek@gmail.com
Tue, 9 May 2006 14:45:15 -0400
On 5/9/06, Bill Moseley <moseley@hank.org> wrote:
> Seems like I was misunderstood. I know the warp and indent plugins.
Yup, sorry about that.
> 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.
Since TT compiles the templates down to perl code, that information
would need to exist in the compiled templates. I had a quick look in
my cache and I don't see that info, so my guess would be no. I would
think that it would be pretty difficult to do reliably as well. What
if you had this situation:
[% some_stuff %]: [% long_text | email_wrap %]
should your filter assume that you are at column 19, or should it wait
to find out what some_stuff resolves to and then count the columns? I
think the safest and cleanest way is just to pass in the indent value
to your filter.
Cheers,
Cees