You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Nathan Bubna (JIRA)" <de...@velocity.apache.org> on 2008/08/20 21:32:44 UTC

[jira] Commented: (VELOCITY-355) lost '#'s inside #literal()/#end

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

Nathan Bubna commented on VELOCITY-355:
---------------------------------------

Yeah, i ran your testbench and didn't see any penalty.  But i spruced up NodeUtils.tokenLiteral's performance a bit anyway.  

I did think about just tweaking Literal.init, except that doesn't fix the fact SimpleNode.literal() isn't doing the right thing.  Also, so far as i can tell, NodeUtils.tokenLiteral() is only "heavy" under circumstances which require it, especially with the improvements i just added.  So, while fixing this in #literal would solve the apparent problems, that still leaves risk of SimpleNode.literal() showing problems in other circumstances.


> lost '#'s inside #literal()/#end
> --------------------------------
>
>                 Key: VELOCITY-355
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-355
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.4
>         Environment: Operating System: All
> Platform: All
>            Reporter: Geoffrey Lowney
>             Fix For: 1.6
>
>         Attachments: velocity-1.6-dev-355-perf.patch
>
>
> I am using VTL (with VPP) to customize a portion of a Perl script. Since Perl
> code has a lot of dollar signs, I am using #literal()/#end to prevent Velocity
> from processing most of the file.  What I find is that single '#' characters
> that are not followed by alpha text are removed (inside #literal()/#end).
> For example:
>   #literal()
>   #!/usr/bin/perl
>   #end
> becomes:
>   !/usr/bin/perl
> I've tried things like escaping the '#' ('\#') but that leaves the backslash
> ('\#!/usr/bin/perl' becomes '\!/usr/bin/perl').  Nothing seems to work.
> I can use a #set to define a variable with the value '#!/usr/bin/perl', but I
> was hoping I would not have to.  It also doesn't help with other single #'s in
> the file (like Perl comments).  For those I have had to double up the hashes.
> I'd be happy to try patching the Velocity source, but I had trouble making heads
> or tails of the parser engine?

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