Since I think of TT macros as very similar to Perl functions that return a result, I intuitively expected that RETURN directive inside a MACRO would leave the MACRO and continue the next line in the calling template.  The calling template was exited as well.

After reading the doc on RETURN, I found that:
The RETURN directive can be used to stop processing the current template and return to the template from which it was called, resuming processing at the point immediately after the INCLUDE, PROCESS or WRAPPER directive. If there is no enclosing template then the Template process() method will return to the calling code with a true value.
OK. I agree that the behavior is what I should have expected after reading the above doc.
Is there some other way to leave a long MACRO early?  Without doing long messy IF/ELSE etc?
Should the action of RETURN be different inside MACRO body?

Bill
======================= Example Case Template ==============================
[% MACRO return_in_macro BLOCK;
    GET 'TEXT FROM MACRO';
    RETURN; #-- Appears to cause the exiting from calling template,
                 #-- not only from the macro.
END; #-- end of MACRO return_in_macro;
-%]
line of text1
line of text2
[% return_in_macro %]
line of text3
line of text4
========================== End of Example ==================================

Reply via email to