You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Denis <ji...@respublica.fr> on 2001/12/01 06:07:32 UTC

formatting issues in template

Hi
Seems that this subject is coming up again...

I'm not sure what the current behaviour is concerning whitespaces.
I *think* that they are suppressed around #directives
Which bears the question... how to render whitespaces around a directive?

Of course, what I should really do is to give it a try with the latest 
CVS head of Velocity... Anyway, here is how I would like it to work:

- comments behave as whitespaces
- all whitespaces are ignored after a #directive
- whitespaces are rendered after any other text
- a special sequence switches between ignore and render whitespaces

The examples of the documentation could be written:


#set( $imperial = ["Munetaka","Koreyasu","Hisakira","Morikune"] )
#foreach( $shogun in $imperial )
     $shogun ###
#end

(### used as special sequence)
Rendered:
Munetaka Koreyasu Hisakira Morikune


Send me###
#set( $foo = ["$10 and","a cake"] ) ##List of wishes
#foreach( $a in $foo )
     ### $a ###
#end
please.

Rendered:
Send me $10 and  a cake please.


I like it because it's simple, but I doubt it's much backward-compatible 
with existing templates... Comments?

-- Denis.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>