Re: How to modify macro paramater value and send it to another macro ?
Daniel Dekany <[email protected]> Mon, 29 Jul 2013 10:50:02 +0200
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Sunday, July 28, 2013, 6:24:39 PM, Albert Kam wrote:
> I would like to pass a hash to a macro, modify the hash's sequence
> value within the macro, and then pass the modified hash to another macro.
>
> I have put on a simple example to illustrate with 'non' freemarker comments :
>
> // try to add 'java' to plugins.tools sequence and pass it to @print
> // but still the plugins passed to @print doesnt contain 'java'
> <#macro printAndModify plugins>
> ${plugins.project} uses <@printList plugins.tools />
> <#local tools=plugins.tools
> tools=tools + ['java']
> 'plugins.tools'=tools>
>
> <@print plugins />
> </#macro>
<#local 'plugins.tools'=tools> just creates a local variable called
"plugins.tools".
You can do this like:
<#macro printAndModify plugins>
${plugins.project} uses <@printList plugins.tools />
<@print plugins + { 'tools': plugins.tools + ['java'] } />
</#macro>
--
Thanks,
Daniel Dekany
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk