You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Jarkko Viinamäki (JIRA)" <de...@velocity.apache.org> on 2010/03/27 22:52:27 UTC

[jira] Updated: (VELOCITY-555) Escape quotes in interpolated strings (both ' and ") by doubling them ('' and "")

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

Jarkko Viinamäki updated VELOCITY-555:
--------------------------------------

    Attachment: velocity-555.patch

This special patch implements a few things:

1. Backslashes are treated as regular characters in string literals (except when user defines Unicode characters). Thus e.g. #set($foo = "\") works.

2. Double and single quotes can be escaped by repeating them. #set($foo = "yeah ""YEAH"" yeah!") $foo would print yeah "YEAH" yeah!

Thus this patch should more or less fix issues related to VELOCITY-587 and VELOCITY-709 as well.

All tests pass but these changes may break some existing user templates. Careful review is needed before commiting this.

> Escape quotes in interpolated strings (both ' and ") by doubling them ('' and "")
> ---------------------------------------------------------------------------------
>
>                 Key: VELOCITY-555
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-555
>             Project: Velocity
>          Issue Type: New Feature
>    Affects Versions: 1.5
>            Reporter: Nathan Bubna
>         Attachments: velocity-555.patch
>
>
> More than a few years, the issue of escaping quotes in interpolated strings was discussed at some length.  Eventually, the list came to a consensus that we should escape them by doubling them, since this would be (or at least very nearly be) backwards compatible and provide a simple solution for this much-wanted feature.
> Geir had working code for this and even posted a test jar, IIRC.  So, many of us thought that this had made it into the 1.5 codebase.   But the code never got checked in and may have been lost.  Assuming Geir can't find the old code or the time to duplicate the effort, we should still try to implement this.
> This issue is open to remind us of that.  If i get around to digging up links to the relevant threads, i will post those in the comments of this issue.

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