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

[jira] Created: (VELOCITY-454) It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?)

It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?)
---------------------------------------------------------------------------------------------------------------------------

                 Key: VELOCITY-454
                 URL: http://issues.apache.org/jira/browse/VELOCITY-454
             Project: Velocity
          Issue Type: Bug
    Affects Versions: 1.4
            Reporter: Bjoern Guenzel
            Priority: Critical
         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


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

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

Nathan Bubna updated VELOCITY-454:
----------------------------------

    Fix Version/s:     (was: 1.6)

very unlikely to happen in 1.6 time frame.  in fact, it's hard to see this happening in 1.x at all due to serious backwards compatibility issues.

> clean up escaping to always escape \$ and \#
> --------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: https://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: 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.
-
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


[jira] Commented: (VELOCITY-454) It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?)

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-454?page=comments#action_12431974 ] 
            
Will Glass-Husain commented on VELOCITY-454:
--------------------------------------------

Yes, this is a real pain.  Right now it's a compatibility issue - if we change it then many user templates will no longer work.  At some point we may issue a new release that cleans up these types of issues (with appropriate warnings to developers about upgrading).  I'll leave this issue open as a reminder to consider cleaning up the escape syntax.

> It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?)
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-454
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Bjoern Guenzel
>            Priority: Critical
>         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


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

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

Byron Foster resolved VELOCITY-454.
-----------------------------------

    Resolution: Fixed

I'm going to close this based on resolving VELOCITY-623.

> clean up escaping to always escape \$ and \#
> --------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: https://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: 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.
-
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


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

Posted by "Bjoern Guenzel (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-454?page=comments#action_12432476 ] 
            
Bjoern Guenzel commented on VELOCITY-454:
-----------------------------------------

Wouldn't it be possible to solve the compatibility issue with a configuration property (use_strict_escaping or something like that)?

> 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: Source
>    Affects Versions: 1.4
>            Reporter: Bjoern Guenzel
>            Priority: Critical
>         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


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

Posted by "Guido Deinhammer (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559850#action_12559850 ] 

Guido Deinhammer commented on VELOCITY-454:
-------------------------------------------

In Addition to the problems above there seems to be no way to escape a plain \ - trying the obvious \\ results in... \\ in the output data. and using  just a single \ anywhere in the template results in a parsing error. This is quite annoying with hardly a useful workaround...other than assigning "\\" to a variable, cutting off the second character and using a variable instead of \
In the context of this ticket this should also be addressed.

> clean up escaping to always escape \$ and \#
> --------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: https://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.
-
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


[jira] Commented: (VELOCITY-454) It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?)

Posted by "Bjoern Guenzel (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-454?page=comments#action_12431912 ] 
            
Bjoern Guenzel commented on VELOCITY-454:
-----------------------------------------

I think I found a workaround: I define a variable with the value '$', then I can use it to escape '$':

#set{$dollarsign = '$'}
${dollarsign}{something == 3}



> It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?)
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-454
>             Project: Velocity
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Bjoern Guenzel
>            Priority: Critical
>         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


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

Posted by "Henning Schmiedehausen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-454?page=all ]

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

        Fix Version/s: 1.6
                       2.0
    Affects Version/s: 1.5

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


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

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567742#action_12567742 ] 

Nathan Bubna commented on VELOCITY-454:
---------------------------------------

For the record, i have no issues putting plain blackslashes \ anywhere in the template except in interpolated strings.

> clean up escaping to always escape \$ and \#
> --------------------------------------------
>
>                 Key: VELOCITY-454
>                 URL: https://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.
-
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


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

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-454?page=all ]

Will Glass-Husain updated VELOCITY-454:
---------------------------------------

        Summary: clean up escaping to always escape \$ and \#  (was: It's impossible to escape ${something == 3} if something is not in the context (in general, why can't $ ALWAYS be escaped?))
     Issue Type: Improvement  (was: Bug)
    Component/s: 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: Source
>    Affects Versions: 1.4
>            Reporter: Bjoern Guenzel
>            Priority: Critical
>         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


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

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-454?page=all ]

Will Glass-Husain updated VELOCITY-454:
---------------------------------------

    Priority: Major  (was: Critical)

It's tricky.  This is specified in the parser syntax, it's not easily made configurable.

> 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: Source
>    Affects Versions: 1.4
>            Reporter: Bjoern Guenzel
>         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


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

Posted by "Henning Schmiedehausen (JIRA)" <ji...@apache.org>.
     [ 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


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

Posted by "Henning Schmiedehausen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-454?page=comments#action_12432794 ] 
            
Henning Schmiedehausen commented on VELOCITY-454:
-------------------------------------------------

I agree that the current parser sucks in that respect. As I wrote in the User Guide, it is mind-boggling that we came up with this, but it is actually tied to how the parser works. I don't see us to be able to fix this in the 1.5 time frame, so I postpone this to 1.6.

> 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: Source
>    Affects Versions: 1.4
>            Reporter: Bjoern Guenzel
>         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