You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ba...@bewag.com on 2005/05/17 12:23:42 UTC
poroblem with linefeed in velocity templates
Hello,
i'll use velocity to generate some textfiles, so i wrote a script like
this:
textfield_one: $ref_variable_one
textfield_two: $ref_variable_two
textfield_three: $ref_variable_three
textfield_four: $ref_variable_four
it was rendered to:
textfield_one: one
textfield_two: two
textfield_three: three
textfield_four: four
everything is fine!
But now after changes to
textfield_one: #if($ref_variable_one != "") $ref_variable_one #end
textfield_two: #if($ref_variable_two != "") $ref_variable_two #end
textfield_three: #if($ref_variable_three != "") $ref_variable_three
#end
textfield_four: #if($ref_variable_four != "") $ref_variable_four #end
it will be render to:
textfield_one: one textfield_two: two
textfield_three: three textfield_four: four
Did anyone know a solution for this problem?
Many thanks!
Mike Bartsch
Re: poroblem with linefeed in velocity templates
Posted by Christoph Reck <ap...@recks.org>.
<grinn/>
this is a case where my StructuredWhitespaceGobbling proposal would
do the right_thing(tm). THis is an example where it minimally breaks BC.
;) Christoph Reck
Shinobu Kawai wrote:
> Hi Mike,
>
>
>>But now after changes to
>>
>>textfield_one: #if($ref_variable_one != "") $ref_variable_one #end
>>textfield_two: #if($ref_variable_two != "") $ref_variable_two #end
>>
>>textfield_three: #if($ref_variable_three != "") $ref_variable_three
>>#end
>>textfield_four: #if($ref_variable_four != "") $ref_variable_four #end
>>
>>it will be render to:
>>
>>textfield_one: one textfield_two: two
>>textfield_three: three textfield_four: four
>>
>>Did anyone know a solution for this problem?
>
>
> Another case of VelocityWhitespaceGobbling.
> http://jakarta.apache.org/velocity/user-guide.html#VTL:%20Formatting%20Issues
> http://wiki.apache.org/jakarta-velocity/VelocityWhitespaceGobbling
>
> One thing you can do, is add a line feed before the #end.
>
> textfield_one: #if($ref_variable_one != "") $ref_variable_one
> #end
> textfield_two: #if($ref_variable_two != "") $ref_variable_two
> #end
>
> textfield_three: #if($ref_variable_three != "") $ref_variable_three
> #end
> textfield_four: #if($ref_variable_four != "") $ref_variable_four
> #end
>
> Best regards,
> -- Shinobu
>
> --
> Shinobu Kawai <sh...@gmail.com>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: poroblem with linefeed in velocity templates
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Mike,
> But now after changes to
>
> textfield_one: #if($ref_variable_one != "") $ref_variable_one #end
> textfield_two: #if($ref_variable_two != "") $ref_variable_two #end
>
> textfield_three: #if($ref_variable_three != "") $ref_variable_three
> #end
> textfield_four: #if($ref_variable_four != "") $ref_variable_four #end
>
> it will be render to:
>
> textfield_one: one textfield_two: two
> textfield_three: three textfield_four: four
>
> Did anyone know a solution for this problem?
Another case of VelocityWhitespaceGobbling.
http://jakarta.apache.org/velocity/user-guide.html#VTL:%20Formatting%20Issues
http://wiki.apache.org/jakarta-velocity/VelocityWhitespaceGobbling
One thing you can do, is add a line feed before the #end.
textfield_one: #if($ref_variable_one != "") $ref_variable_one
#end
textfield_two: #if($ref_variable_two != "") $ref_variable_two
#end
textfield_three: #if($ref_variable_three != "") $ref_variable_three
#end
textfield_four: #if($ref_variable_four != "") $ref_variable_four
#end
Best regards,
-- Shinobu
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org