[jira] [Created] (VELOCITY-991) with changes in 2.4 $bodyContent is harder to use in nested macros

"Alex (Jira)" <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.devel
Message-ID <[email protected]>
Alex created VELOCITY-991:
-----------------------------

             Summary: 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


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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.