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

[jira] [Resolved] (VELOCITY-792) Template if statement throws off tabbing

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

Claude Brisson resolved VELOCITY-792.
-------------------------------------
    Resolution: Fixed
      Assignee: Claude Brisson

Resolved by the `lines` or 'structured' space gobbling mode in v2.x.



> Template if statement throws off tabbing
> ----------------------------------------
>
>                 Key: VELOCITY-792
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-792
>             Project: Velocity
>          Issue Type: Improvement
>    Affects Versions: 2.x
>         Environment: Eclipse IDE. 
> Microsoft XP.
>            Reporter: Kevin Swanson
>            Assignee: Claude Brisson
>             Fix For: 2.x
>
>
> When using a velocity template for XML output. I encounter tabbing issues when using an IF statement. Below you can find an example of what is happening:
> Template which produces erroneous tabbing:
> #foreach($order in $orderList)
> 		<type>
>     			#if("$order.type" == "AZ")
>     			<AZ>
>                             <fiveYears>$order.typeVar1</fiveYears>
>                             <thirtyNineMonths>$order.typeVar2</thirtyNineMonths>
>                         </AZ>
>                         #end
>                </type>
> #end
> Output of erroneous tabbing:
> 				<type>
>     				    				<AZ>
>                         <fiveYears>true</fiveYears>
>                         <thirtyNineMonths>false</thirtyNineMonths>
>                     </AZ>
>                                </type>
> If I remove the indentation from the #if and #end then the output is normal. Having to remove the indentation is undesirable as it makes the template difficult to read.
> Template with removed indentation for #if and #end:
> #foreach($order in $orderList)
> 		<type>
> #if("$order.type" == "AZ")
>     			<AZ>
>                             <fiveYears>$order.typeVar1</fiveYears>
>                             <thirtyNineMonths>$order.typeVar2</thirtyNineMonths>
>                         </AZ>
> #end
>                </type>
> #end
> Output with indentation for #if and #end removed;
>                 <type>
>                     <AZ>
>                         <fiveYears>true</fiveYears>
>                         <thirtyNineMonths>false</thirtyNineMonths>
>                     </AZ>
>                 </type>



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