[
https://issues.apache.org/jira/browse/VELOCITY-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660597#action_12660597
]
Jarkko Viinamäki commented on VELOCITY-661:
-------------------------------------------
Thanks for the comments. I don't have the energy to start building separate
patch files of those changes right now. Nathan, I'll get back to you about
those CLA issues.
I experimented with different token types and indeed at one point I considered
using "#%% " (forgot to update the JavaDoc) but it's not as simple as "#% "
which I find better. It's consistent with the regular comment format #* this is
a comment *#
If you need to include " %#" (notice that it has to contain the leading
whitespace to cause "problems") inside #% block %#, then you can easily work
around it e.g. by dividing the textblock in half:
#% this is the first part %# %# #% this is the second part %#
will result in
this is the first part %# this is the second part
Note that it's perfectly ok to write: #% this is a comment with stuff%# in it
%#
I'd guess that " %#" is unlikely enough. Anyway, it's a matter of taste and
both work. I just like simplicity. :)
> Parsing errors on content inside #literal() #end block
> ------------------------------------------------------
>
> Key: VELOCITY-661
> URL: https://issues.apache.org/jira/browse/VELOCITY-661
> Project: Velocity
> Issue Type: Improvement
> Components: Engine
> Affects Versions: 1.6.1
> Environment: ALL
> Reporter: ND
> Attachments: velocity-661-v1.0.patch
>
>
> I have some velocity templates that include quit some javascript. Inside the
> javascript a javascrip template engine is used which also uses ${varname}
> Escaping each occurance would make the code rather unreable, so to prevent
> velocity from parsing the javascript code, I put a #literal() around it.
> However, velocity still PARSES the contents of this block, which of course
> results in parsing exceptions.
> My feeling with "literal" is that it is completely UNINTERPRETED content?
> This SHOULD work:
> #literal()
> var myId = 'someID';
> $('#test).append($.template('<div id="${myId}"></div>').apply({myId: myId}));
> #end
--
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]