[Templates] RETURN'ing from a MACRO ... BLOCK
Darren Chamberlain
dlc@sevenroot.org
Sun, 1 Oct 2006 06:45:41 -0400
On 9/30/06, Paul Makepeace <paulm@paulm.com> wrote:
> I think I've just been bitten by how MACRO and RETURN work,
>
> [% MACRO do_stuff(an_array) BLOCK %]
> [% RETURN IF !an_array OR an_array.size == 0 %]
> # Actually do stuff
> [% END %]
>
> [% do_stuff() %]
>
> [%# we never get here %]
>
> What's the right way to do what I'm trying here?
The MACRO directive inserts its code directly into the compiled
template, so in this example it's as if you'd written:
[% BLOCK %]
[% RETURN IF !an_array OR an_array.size == 0 %]
# Actually do stuff
[%# we never get here %]
--
(darren)