You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Claude Brisson (Jira)" <ji...@apache.org> on 2023/03/26 13:26:00 UTC

[jira] [Commented] (VELOCITY-940) bodyContent in nested macros called without @ should be unset

    [ https://issues.apache.org/jira/browse/VELOCITY-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17705080#comment-17705080 ] 

Claude Brisson commented on VELOCITY-940:
-----------------------------------------

Velocimacros do support recursion. But there was a specific bug whenever using a non-block call inside a block. Fixed in 2.4.

> Probably related, if you call a #@macro from inside another #@macro, the $bodyContent gets trashed, as in it doesn't seem to get restored when the inner macro finishes.

Not reproduced. But one thing to note: if you alter the content of $bodyContent with a #set directive, the initial value won't be restored. This is by design.


> bodyContent in nested macros called without @ should be unset
> -------------------------------------------------------------
>
>                 Key: VELOCITY-940
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-940
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.7.x, 2.3
>            Reporter: Willow Nice
>            Priority: Minor
>
> Hi! First ever maybe bug report (pls be gentle).
>  
> {{#macro(test $label)Something $!label $!bodyContent#\{end}}}
> {{#@test('First')}}{{#test('Second')}}{{#end}}
>  
> ends up a recurring mess because $bodyContent seems to be still defined when calling the inner macro without a block. I propose (perleeze) that it should always be unset when calling a macro without a block. It's fine if you always call with @ and supply an empty block, or unset it manually before the second call
> p.s.
> #@\{test} or #\{@test} doesn't work either
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org