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

Nate Chadwick commented on VELOCITY-542:
----------------------------------------

Hi Claude,

I agree that having to have space-1 is weird.  I just don't think that changing 
the language to remove hyphens is a correct fix for that specific problem.  
There must be a valid pattern for the identifiers regex in the parser 
definition that can exclude the dash0-9 pattern from the end of an identifier.  
Need a little time to research that.  

In terms of other issues. So far we have hit 6 general patterns of issues.  We 
mitigated several by adding a "precompiler" that replaces known broken patterns 
in templates and macro files before they get passed to the engine. I don't know 
 how that could be translated into a contribution to the project at this time.

1.  Hyphen in variables (required forked velocity jar - patterns to complex)

2. "#" "$" fail to parse (VELOCITY-896) (VELOCITY-897)

3. String.replaceAll("someregexwith$#")

4. velocityCount, velocityHasNext (understood this is documented and by design 
but still had to be replaced)

5. Macro file or template that is 100% commented out (fails to parse)

6. Macro parameter handling seems to now require variable name to match macro 
parameter name or value is not returned (we have a fix for this and a property 
that we can definitely contribute if the behavior was intentional) need to 
search velocity Jira to see if there is a known issue already for this or not.

These problems are compounded when they are in Velocity Macro files as the 
Engine completely fails to initialize if ANY macro in any of the VM files 
passed in as a library fails to parse.  So essentially one "#" in a single 
macro file will break all macro's and templates until it is replaced - the 
optics of which are pretty bad to end users. This may be related to how we load 
macro files.  Still trying to sort that out. 

Thanks,

-n

 

 

 

> minus sign in #set requires spaces to surround it
> -------------------------------------------------
>
>                 Key: VELOCITY-542
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-542
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Will Glass-Husain
>            Assignee: Claude Brisson
>            Priority: Minor
>             Fix For: 2.0
>
>
> The following example:
> #set($thisCampNumber = 10)
> #set($nextCampNumber = $thisCampNumber+1)
> #set($previousCampNumber = $thisCampNumber-1)
> #set($previousCampNumberB = $thisCampNumber - 1)
> 1: $thisCampNumber<br>
> 2: $nextCampNumber<br>
> 3: $previousCampNumber<br>
> 4: $previousCampNumberB<br>
> produces this result
> 1: 10
> 2: 11
> 3: $previousCampNumber
> 4: 9
> Note that using a minus sign in a #set statement does not work if there are 
> no spaces around it.  (however, the same is not true for +).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to