You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Nathan Bubna (JIRA)" <de...@velocity.apache.org> on 2008/07/01 16:26:46 UTC
[jira] Resolved: (VELOCITY-601) escaping when { used doesn't work
[ https://issues.apache.org/jira/browse/VELOCITY-601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nathan Bubna resolved VELOCITY-601.
-----------------------------------
Resolution: Later
Fix Version/s: 2.0
"test test test" is not a valid reference name. therefore, reference escaping syntax does not work. i realize that is a bit confusing, but that is why this fails. the \$ syntax is for escaping valid references. if you are trying to prevent velocity from considering ${test test test} to be an invalid reference and throwing a parse exception, you should follow the advice given in the JIRA issue which you cloned:
#set( $D = '$' )
$D{test test test}
or (if you use the EscapeTool from VelocityTools):
$esc.d{test test test}
there are no planned or intended updates to the escaping syntax in the 1.x series (i.e. \$ will continue to only work for valid references). this is something that may well be changed in version 2, though.
> escaping when { used doesn't work
> ---------------------------------
>
> Key: VELOCITY-601
> URL: https://issues.apache.org/jira/browse/VELOCITY-601
> Project: Velocity
> Issue Type: Bug
> Affects Versions: 1.5
> Reporter: Harald Haas
> Fix For: 2.0
>
>
> trying to escape by
> \${test test test}
> results in
> Error while rendering template
> org.apache.velocity.exception.ParseErrorException: Encountered " test test}\n" at line 2, column 8 of 26
> Was expecting one of:
> "}" ...
> <DOT> ...
> at org.apache.velocity.Template.process(Template.java:137)
> at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:415)
> at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:335)
> at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1102)
> at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:324)
> at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:473)
> ...
--
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