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

Sergiy Kovalchuk commented on VELOCITY-808:
-------------------------------------------

Actually after thinking about it I realized that those "arguments" don't have 
any sense if they are not mapped to anything. So maybe it would be possible to 
map them to something like $args[]. For example (using commas to separate 
arguments looks more natural):

#set($var2 = 2)
#set($var3 = 3)
#parse("tpl.vm", 10, $var2+$var3) 

With tpl.vm being:

argument1= ${args[0]}         //10, comes from argument
argument2 = ${args[1]}        //5, from argument
var3 = ${var3}                     //3, comes from global scope

> Proposal to add ability to pass variables to #parse()
> -----------------------------------------------------
>
>                 Key: VELOCITY-808
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-808
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.7
>            Reporter: Sergiy Kovalchuk
>              Labels: parse
>
> I think it would be very useful to be able to pass variables to #parse(), 
> just like to #macro():
> #parse("tpl.vm" $var1 $var2 $var3)
> This would add $var's to a local scope of "tpl.vm".
> Current approach of adding vars to a parent template above pollutes global 
> namespace.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to