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

emassip edited comment on VELOCITY-565 at 9/18/07 7:31 AM:
------------------------------------------------------------------

here is the patch.

Met another problem writting my test case, unrelated to the current issue :

It seems that there is not eol characters in output when the syntax is :

#foreach(..)
    my output whith #evaluate(..)
#end

gives on a single line :

      my output whith (?)      my output whith (?)      etc...

Eol is written when syntax is :

#foreach(..)
    my output whith #evaluate(..)1
#end

gives as expected a multiline output :

    my output whith (?)1
    my output whith (?)1
    etc...

so my test case does not expect any eol (in .cmp).
seems like parser is responsible for not creating an ASTText node containing 
the \r\n sequence.

hope it helps

      was (Author: emassip):
    here is the patch.

Met another problem writting my test case, unrelated to the current issue :

It seems that there is not eol characters in output when the syntax is :

#foreach(..)
    my output whith #evaluate(..)
#end

gives on a single line :

      my output whith (?)      my output whith (?)      etc...

Eol is written when syntax is :

#foreach(..)
    my output whith #evaluate(..)1
#end

gives as expected a multiline output :

    my output whith (?)1
    my output whith (?)1
    etc...

so my test case does expect any eol (in .cmp).
seems like parser is responsible for not creating an ASTText node containing 
the \r\n sequence.

hope it helps
  
> EvaluateContext does not take account of inner.localContext
> -----------------------------------------------------------
>
>                 Key: VELOCITY-565
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-565
>             Project: Velocity
>          Issue Type: Bug
>            Reporter: Will Glass-Husain
>            Assignee: Will Glass-Husain
>            Priority: Minor
>             Fix For: 1.6
>
>         Attachments: EvaluateContext.java, evalvmcontext.patch
>
>
> the following vtl does not render what is, IMHO, expected :
> #macro(testEval $expr)
>     #foreach($value in ["val1", "val2"])
>         value is : #evaluate( $expr )
>     #end
> #end
> #testEval( "${value}" )
> renders :
> value is : ${value}
> value is : ${value}
> The reason is that EvaluateContext ctor assigns 'inner.getBaseContext()'
> to instance variable 'innerContext', and getBaseContext() does not
> return VMContext localContext refs (of the #foreach directive).
> Changing the EvaluateContext ctor so that 'innerContext' is set to
> 'inner' allow velocity to render the right result :
> value is : val1
> value is : val2
> But I'm not sure this would be a correct fix, should the VMContext
> return all current refs ? Could you tell me what the normal behavior is
> and what is the way all that stuff sould work ?
> Etienne Massip

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to