You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Alexander Rosenberg (JIRA)" <ji...@apache.org> on 2016/05/09 04:05:12 UTC

[jira] [Updated] (VELOCITY-874) Addition works, but subtraction doesn't

     [ https://issues.apache.org/jira/browse/VELOCITY-874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Rosenberg updated VELOCITY-874:
-----------------------------------------
    Description: 
This works as expected:
{noformat}
## @noparams

#set ($n = 5)
#set ($m = $n+1)
<p>$m</p>
{noformat}

Output: {{<p>6</p>}}

However, subtraction doesn't work:
{noformat}
## @noparams

#set ($n = 5)
#set ($m = $n-1)
<p>$m</p>
{noformat}

Output: {{<p>$m</p>}}

From [SO Q&A #15448108|http://stackoverflow.com/questions/15448108/subtraction-is-not-working-with-velocity-template], it appears that this behavior is due to the parser treating the hyphen/dash/minus-sign as part of the identifier, but certainly an exception should be made for when the "identifier" ends with only digits and/or hyphens.

  was:
This works as expected:
{noformat}
## @noparams

#set ($n = 5)
#set ($m = $n+1)
<p>$m</p>
{noformat}

Output: {{<p>6</p>}}

However, subtraction doesn't work:
{noformat}
## @noparams

#set ($n = 5)
#set ($m = $n-1)
<p>$m</p>
{noformat}

Output: {{<p>$m</p>}}


> Addition works, but subtraction doesn't
> ---------------------------------------
>
>                 Key: VELOCITY-874
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-874
>             Project: Velocity
>          Issue Type: Bug
>         Environment: VTL in user macro in Atlassian Confluence 5.9.4
>            Reporter: Alexander Rosenberg
>
> This works as expected:
> {noformat}
> ## @noparams
> #set ($n = 5)
> #set ($m = $n+1)
> <p>$m</p>
> {noformat}
> Output: {{<p>6</p>}}
> However, subtraction doesn't work:
> {noformat}
> ## @noparams
> #set ($n = 5)
> #set ($m = $n-1)
> <p>$m</p>
> {noformat}
> Output: {{<p>$m</p>}}
> From [SO Q&A #15448108|http://stackoverflow.com/questions/15448108/subtraction-is-not-working-with-velocity-template], it appears that this behavior is due to the parser treating the hyphen/dash/minus-sign as part of the identifier, but certainly an exception should be made for when the "identifier" ends with only digits and/or hyphens.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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