[
https://issues.apache.org/jira/browse/VELOCITY-614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633541#action_12633541
]
Nathan Bubna commented on VELOCITY-614:
---------------------------------------
Christopher, you've never been noise. :)
Anyway, Guillaume's original concern was that #something(Stuff) used to work
fin in pre-1.6 versions. But with the addition of the RuntimeMacro stuff in
1.6, it started throwing parse errors, because 1.6 has to treat everything that
looks like a macro as if it were, etc.
The escaping attempt was just to try and circumvent the error. Of course,
that still didn't work because #something was still not a macro. You have to
remember in Velocity 1.x, it has always been the case that you do not ever
escape just $ or #. What you escape are references, macros and directives
which happen to start with either # or $. If you put a \ in front of something
that looks like a reference, macro or directive, but is not, then it does
nothing whatsoever.
Yes, this is confusing to most people who are used to just escaping characters.
But it is far too late to change this in the 1.x series. When ever someone
starts a 2.x branch, we can (and probably will) change that. But for now,
\#schmoo() will print \#schmoo() and \#validmacro() will print #validmacro().
There is no character escaping with \ and there never has been in Velocity. If
you want character escaping, you have to use EscapeTool or poor man's style
(#set( $H = '#' ) ${H}schmoo(). I've tried to clarify the docs on this for
1.6, but they could probably use more tweaking still.
> Impossible to escape '#' if followed by text and parenthesis(
> "\#something(Stuff)" renders with the '\')
> --------------------------------------------------------------------------------------------------------
>
> Key: VELOCITY-614
> URL: https://issues.apache.org/jira/browse/VELOCITY-614
> Project: Velocity
> Issue Type: Bug
> Affects Versions: 1.6
> Environment: I don't think it is relevant but still: CPU Intel
> Pentium D, windows XP SP3, JRE 1.6.0_07, Velocity 1.6-beta1
> Reporter: Guillaume Polet
> Priority: Minor
> Fix For: 1.6
>
> Attachments: Velocity614TestCase.java
>
>
> "#something(Stuff)" in your templates (without the double quotes) causes a
> parse error.
> "\#something(Stuff)" in your template (without the double quotes) renders as
> "\#something(Stuff)"
> Either the first line should go through just fine, or the next one should not
> render the '\'
> This typically happens when you try to generate JavaDoc for overriding
> methods.
> Don't hesitate to contact me if this is not clear enough or if you are unable
> to reproduce 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]