xslate / p5-Text-Xslate

Scalable template engine for Perl5

Home Page:https://metacpan.org/release/Text-Xslate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TTerse [% WRAPPER %] ignores content before and after

bluefeet opened this issue · comments

A template like this:

Foo
[% WRAPPER 'foo.tt' %]
Baz
[% END %]
Bar

Does not render "Foo" and "Bar" strings and actually produces these warnings:

Xslate: Useless use of text 'Foo' at /usr/local/lib/perl/5.14.2/Text/Xslate/Compiler.pm line 495.
Xslate: Useless use of text 'Bar' at /usr/local/lib/perl/5.14.2/Text/Xslate/Compiler.pm line 495.

In vanilla-TT I'm able to render content before and after wrappers, and can even include multiple wrappers in the same document. Seems TTerse doesn't allow this, which greatly diminishes TTerse as a useful syntax for transitioning an existing TT site to Xslate. Any ideas?

I've worked around this issue using MACRO. So the above sample works as:

Foo
[% MACRO foo BLOCK %]
Baz
[% END -%]
[% INCLUDE 'foo.tt' WITH content => foo() %]
Bar

I think that properly simulates TT wrappers, at least it appears so.

Maybe the fix is to just document this workaround?

As you has pointed at, WRAPPER is not completely compatible with TT. Using MACRO is the best solution for it. Thanks.