You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning Schmiedehausen (JIRA)" <ji...@apache.org> on 2006/11/06 22:31:38 UTC

[jira] Commented: (VELOCITY-262) #set not parsed in #macro

    [ http://issues.apache.org/jira/browse/VELOCITY-262?page=comments#action_12447540 ] 
            
Henning Schmiedehausen commented on VELOCITY-262:
-------------------------------------------------

I built a small test bed using

--- cut ---
#macro(issue262 $baz)
	#set ($bar = "$baz")
	#set ($foo = "inside macro!")
#end
--- cut ---

in the global macros file and

--- cut ---
<pre>
$foo

#issue262("from macro")
$foo
$bar	
	
#set ($foo = "foo")
#set ($bar = "empty")
$foo
$bar

#issue262("from macro2")
$foo
$bar	

</pre>
--- cut ---

as template. This rendered as:

--- cut ---
$foo

inside macro!
from macro	
	
foo
empty

inside macro!
from macro2	
--- cut ---

So 

1) $foo was unset (the macro definition in the global macros file did not change this value in any way)

2) $foo and $bar were set (changed) inside the macro. This is visible on the outside as $foo and $bar
    changed values.

3) $foo and $bar could be changed on the template to other values. 

4) running the macro again (with another value for the parameter resulted in another value for $bar. So
    re-evaluating the macro does change the value of the reference.

Works as expected, if you ask me. Any comments / could you try your case with Velocity 1.5? I tend to close the case as "cannot reproduce".

> #set not parsed in #macro
> -------------------------
>
>                 Key: VELOCITY-262
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-262
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.4
>         Environment: Operating System: All
> Platform: PC
>            Reporter: Mike Kienenberger
>         Assigned To: Henning Schmiedehausen
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: output.htm, scheduledPaymentsTable.macro.txt
>
>
> #set statements are not being parsed in #macros in VM_global_library.
> Worked in 1.3.1, doesn't in 1.4.
> I'm going to attach the #macro and the diff'd 1.3.1 vs 1.4 output.
> -Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org