[ 
https://issues.apache.org/jira/browse/VELOCITY-519?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nathan Bubna resolved VELOCITY-519.
-----------------------------------

    Resolution: Won't Fix

Sorry Stepan, VTL (Velocity Template Language) is *not* java, nor do we have 
any intention of making it so.   It is designed to be a simple templating 
language with a small feature set that is quick for anyone to learn.  We have 
several times in the past debated supporting various escaping schemes in string 
literal definitions (that's what your example is about, not macros), but the 
only escaping feature that managed to gather a consensus among the developers 
was MySQL like quote and double quote escaping and even that has not been added 
yet.  Search the archives for more history on this.

Do your escaping in Java or create a tool (or even a patch for this: 
http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/EscapeTool.html)
 to support doing this within templates.

Personally, the soonest i would be interested in re-opening discussion on 
escaping within string definitions would be when work has started on Velocity 
2.0.  Until then, this gets a -1 from me.

> Java escape sequences should work in Velocity macros
> ----------------------------------------------------
>
>                 Key: VELOCITY-519
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-519
>             Project: Velocity
>          Issue Type: New Feature
>    Affects Versions: 1.5 beta2
>            Reporter: Stepan Koltsov
>
> Following test should work:
> ===
>     public void testJavaEscape() throws Exception {
>         VelocityEngine ve = new VelocityEngine();
>         ve.init();
>         Context context = new VelocityContext();
>         StringWriter writer = new StringWriter();
>         ve.evaluate(context, writer, "test","#set($v = \"\\u0061\")$v");
>         assertEquals("a", writer.toString());
>         writer = new StringWriter();
>         ve.evaluate(context, writer, "test","#set($v = \"\\n\")$v");
>         assertEquals("\n", writer.toString());
>     }
> ===

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