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/05 13:41:22 UTC

[jira] Updated: (VELOCITY-454) clean up escaping to always escape \$ and \#

     [ http://issues.apache.org/jira/browse/VELOCITY-454?page=all ]

Henning Schmiedehausen updated VELOCITY-454:
--------------------------------------------

    Component/s: Engine
                     (was: Source)

> clean up escaping to always escape \$ and \#
> --------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-454
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.4, 1.5
>            Reporter: Bjoern Guenzel
>             Fix For: 1.6, 2.0
>
>         Attachments: testVelocity.vm
>
>
> I want to use Velocity to generate a template for UJAC, which uses a very similiar templating language to Velocity. Therefore escaping is a primary concern.
> I am surprised that there seems to be no way to just escape "$" and "#" in general. 
> Suppose we have the line \$name
> If name is in the context, this will evaluate to $name, otherwise it will evaluate to \$name 
> The real problem starts if there is something to escaped like
> ${something == 3}  (this is something that might occur in a UJAC template)
> This gives an error in both cases: ${something == 3}  and \${something == 3} both give an error ("} expected" or something like that).
> My guess is that Velocity get's confused when trying to evaluate "something == 3" to see if it is something that is known and should be escaped or something that is unknown and should not be escaped.
> In my opinion the proper behaviour for escaping characters would be to ALWAYS escape, independent of the context. 
> Even if the current way of escaping would work in all cases, there would be a major problem with it. I can't give the velocity template to the Designer, because only the developer knows all the variables that exist in the context. So the designer is unable to properly escape all the variables. I think it would be important to have a way to simply escape everything.

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