[ 
https://issues.apache.org/jira/browse/VELOCITY-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660640#action_12660640
 ] 

Nathan Bubna commented on VELOCITY-661:
---------------------------------------

Hmm.  I don't think "#%  " is going to be that much more common, but i've also 
started thinking that the required space might be confusing if someone tries:

#%
block
%#

which is very likely, i think.  The extra space also makes "#% " a challenge 
for both writer and reader of documentation.  So, i think we need to do either 
#% or #%%, without the space.   #%% is definitely less likely, but really, the 
only situations i can think of for #% are "fake cussing"  like #...@$! or maybe 
some regex.    In both of those already unusual cases, #%% seems much less 
likely.

I do prefer the way that #% block %# looks, but even #%% block %%#  looks a lot 
better than the current workarounds.  I think i'll adapt the patch to do the 
latter one, as i'd rather not have any fake cussing lead to the real deal. ;-)  
Also, the latter would be much more forward compatible if we later decide to 
cut it back to #% block %# for aesthetic (or other) reasons.

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

Reply via email to