[ 
https://issues.apache.org/jira/browse/VELOCITY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claude Brisson closed VELOCITY-991.
-----------------------------------
    Resolution: Won't Fix

Since the same macro can be called with or without a body, it's important to 
set {{$bodyContent}} to null when there is no body otherwise it would introduce 
an ambiguity.
Macros don't have a local scope, and since there is an easy workaround as you 
said, so I'm not sure that we can retain this proposal.
So thanks for the suggestion but we will keep it as it is...

> 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