How to modify macro paramater value and send it to another macro ?

Albert Kam <[email protected]> Sun, 28 Jul 2013 23:24:39 +0700
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAMT20g9AVcMb2xQ3a-VvwJCq0iFTzkRWR0C12ToezNRrJwgKWw@mail.gmail.com>
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>

<#macro print plugins>
${plugins.project} uses <@printList plugins.tools />
</#macro>

<#macro printList list>
<#list list as item>${item} </#list>
</#macro>

<#assign plugins={'project' : 'cool project', 'tools' : ['freemarker']}>

<@printAndModify plugins />


The output of the project is :

cool project uses freemarker

 cool project uses freemarker


The expected output is :

cool project uses freemarker

 cool project uses freemarker java

Is there anyway to do this in the ftl ? Thank you.

-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

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

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user