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/04/04 01:40:32 UTC

[jira] Commented: (VELOCITY-519) Java escape sequences should work in Velocity macros

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

Will Glass-Husain commented on VELOCITY-519:
--------------------------------------------

Nice work, Nathan (and kudos to Stepan)  on VELOCITY-520.

I seem to be the only one on this thread who liked the idea of \t, \r, \n.   But after thinking about it, I'm worried about compatibility of templates that specify those symbols when generating Java code, so I withdraw my suggestion.

(or at least, I agree we should not do this for any 1.x releases).

> 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
>          Components: Engine
>    Affects Versions: 1.5 beta2
>            Reporter: Stepan Koltsov
>             Fix For: 2.0
>
>         Attachments: velocity-unescape-2007-02-24-stepancheg.diff, velocity-unescape-only-u-2007-02-24-stepancheg.diff
>
>
> 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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org