[Templates] RETURN'ing from a MACRO ... BLOCK

Paul Makepeace paulm@paulm.com
Sun, 1 Oct 2006 03:21:12 +0100


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?

This works but seems a hack,

[% BLOCK do_stuff_ %] ... [% END %]
[% MACRO do_stuff INCLUDE do_stuff_ %]

Paul