You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org> on 2007/01/03 05:47:27 UTC

[jira] Created: (VELOCITY-509) Add new directive #evaluate

Add new directive #evaluate
---------------------------

                 Key: VELOCITY-509
                 URL: https://issues.apache.org/jira/browse/VELOCITY-509
             Project: Velocity
          Issue Type: New Feature
          Components: Engine
    Affects Versions: 1.5 beta2
            Reporter: Will Glass-Husain
            Priority: Minor
             Fix For: 1.6


On a separate issue (VELOCITY-504) we came up with the idea of a new directive, #evaluate.  Basically, it would act just like Velocity.evaluate().  

Users are always asking for this capability (internal evaluation).  Usually we tell them to "use a tool".  Instead, we should just put in a simple directive that would evaluate a VTL string using the current context.

Incidentally, this should be the current local context, e.g. if inside a macro or a foreach loop (or worse, both) it should use that context.  See VELOCITY-504 for why this is needed.

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

        

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


Re: [jira] Created: (VELOCITY-509) Add new directive #evaluate

Posted by ap...@recks.org.
No, the #evaluate directive is to be used as it the following example:

#set( $error = $i18n_tool.getMessage("ERROR123") )
#evaluate( $error )## reder by merging with context

It something like the #parse directive, but the content comes
from a string and not a file.

:) Christoph

Geir Magnusson Jr. wrote:
> Do you mean
> 
>   $foo = "#foreach($a in $b) ...... #end"
> 
> ?
> 
> If so, why not just do it that way, rather than add a new directive?
> 
> geir
> 
> 
> On Jan 2, 2007, at 11:47 PM, Will Glass-Husain (JIRA) wrote:
> 
>> Add new directive #evaluate
>> ---------------------------
>>
>>                  Key: VELOCITY-509
>>                  URL: https://issues.apache.org/jira/browse/VELOCITY-509
>>              Project: Velocity
>>           Issue Type: New Feature
>>           Components: Engine
>>     Affects Versions: 1.5 beta2
>>             Reporter: Will Glass-Husain
>>             Priority: Minor
>>              Fix For: 1.6
>>
>>
>> On a separate issue (VELOCITY-504) we came up with the idea of a new
>> directive, #evaluate.  Basically, it would act just like
>> Velocity.evaluate().
>>
>> Users are always asking for this capability (internal evaluation). 
>> Usually we tell them to "use a tool".  Instead, we should just put in
>> a simple directive that would evaluate a VTL string using the current
>> context.
>>
>> Incidentally, this should be the current local context, e.g. if inside
>> a macro or a foreach loop (or worse, both) it should use that
>> context.  See VELOCITY-504 for why this is needed.
>>
>> --This message is automatically generated by JIRA.
>> -
>> If you think it was sent incorrectly contact one of the
>> administrators: https://issues.apache.org/jira/secure/Administrators.jspa
>> -
>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: dev-help@velocity.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
> 
> 

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


Re: [jira] Created: (VELOCITY-509) Add new directive #evaluate

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.
Do you mean

   $foo = "#foreach($a in $b) ...... #end"

?

If so, why not just do it that way, rather than add a new directive?

geir


On Jan 2, 2007, at 11:47 PM, Will Glass-Husain (JIRA) wrote:

> Add new directive #evaluate
> ---------------------------
>
>                  Key: VELOCITY-509
>                  URL: https://issues.apache.org/jira/browse/ 
> VELOCITY-509
>              Project: Velocity
>           Issue Type: New Feature
>           Components: Engine
>     Affects Versions: 1.5 beta2
>             Reporter: Will Glass-Husain
>             Priority: Minor
>              Fix For: 1.6
>
>
> On a separate issue (VELOCITY-504) we came up with the idea of a  
> new directive, #evaluate.  Basically, it would act just like  
> Velocity.evaluate().
>
> Users are always asking for this capability (internal evaluation).   
> Usually we tell them to "use a tool".  Instead, we should just put  
> in a simple directive that would evaluate a VTL string using the  
> current context.
>
> Incidentally, this should be the current local context, e.g. if  
> inside a macro or a foreach loop (or worse, both) it should use  
> that context.  See VELOCITY-504 for why this is needed.
>
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the  
> administrators: https://issues.apache.org/jira/secure/ 
> Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/ 
> software/jira
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
>


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


[jira] Resolved: (VELOCITY-509) Add new directive #evaluate

Posted by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Glass-Husain resolved VELOCITY-509.
----------------------------------------

    Resolution: Fixed

Implemented, though still need to write the user docs.

A good example:

#set($vtl = 'learn the alphabet $test1')

#set($test1 = "abc")
#evaluate($vtl)

#set($test1 = "xyz")
#evaluate($vtl)

will display (removing blank lines).
  learn the alphabet abc
  learn the alphabet xyz

Note that the reference "$vtl" needs single quotes to avoid evaluating $test1 up front.



> Add new directive #evaluate
> ---------------------------
>
>                 Key: VELOCITY-509
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-509
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 1.5 beta2
>            Reporter: Will Glass-Husain
>            Priority: Minor
>             Fix For: 1.6
>
>
> On a separate issue (VELOCITY-504) we came up with the idea of a new directive, #evaluate.  Basically, it would act just like Velocity.evaluate().  
> Users are always asking for this capability (internal evaluation).  Usually we tell them to "use a tool".  Instead, we should just put in a simple directive that would evaluate a VTL string using the current context.
> Incidentally, this should be the current local context, e.g. if inside a macro or a foreach loop (or worse, both) it should use that context.  See VELOCITY-504 for why this is needed.

-- 
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org