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

Alex commented on VELOCITY-991:
-------------------------------

See: Velocity-940.

All other context variables are not removed before calling inner macros and so 
are available directly in the inner macro. Apparently this was causing some 
issues with $bodyContent referred to in "940".

Perhaps it is better to make it available explicitly as $macro.bodyContent at 
macro scope? This way $macro.parent.bodyContent can be used as well and there 
is no need to remove/remember/restore it as a special case.

> with changes in 2.4 $bodyContent is harder to use in nested macros
> ------------------------------------------------------------------
>
>                 Key: VELOCITY-991
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-991
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.4
>            Reporter: Alex
>            Priority: Minor
>
> With this commit: 
> [https://github.com/apache/velocity-engine/commit/a643483629ebe2659f732a388deb859042cf8125]
> $bodyContent variable is removed from the context before handleArguments for 
> inner macro are processed. This makes the $bodyContent unavailable to pass a 
> parameter and also makes it unavailable in the inner macro without renaming.
> Consider example:
> ========
> #macro(inner $content)
> before $content after
> #end
>  
> #macro(outer)
>     ## here $bodyContent is no longer available
>     #inner($bodyContent)
> #end
>  
> @#outer()
> body text
> #end
> ================
> In version 2.3 $bodyContent from the outer macro could be used in the inner 
> macro without passing it directly.
> At the moment it needs to be renamed as a workaround:
> =================
> #macro(outer)
>     ## rename $bodyContent i
>     #set($macro.bodyContent = $bodyContent)
>     #inner($macro.bodyContent)
> #end
> =================
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to