velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Colson" <tcol...@cisco.com>
Subject RE: Whitespace, redux
Date Mon, 15 Apr 2002 15:45:35 GMT

> On 4/13/02 5:35 AM, "Joaquim Carvalho" <jrc@bookmarc.pt> wrote:
... about explicitly turning on/off whitespace gobbling by Velocity,
coupled with an explicit way to 'print' ouput using "#echo"

Geir replied to this approach:
> This is *damn* cute. :)  

...which is far more warmth than -most- other suggestions on how to
gobble whitespace according to a set of complex rules.


Uh, no slight meant to Joaquim, but am I chopped liver!?? <grin>

>From Nov 2001 - pretty much the exact same idea. ;-)
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg04134.ht
ml

And more recently from March 2002 (see #gobblewhitespace(off) )
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg05992.ht
ml


> 3. In macros and #parsed templates it is necessary to save 
> and restore  the previous output status so that other templates can 
> safely use code in other files:
>
> #output("hold") ## Sames as "off" but the current output state is 
> remembered 

This additional idea is worth it's weight in latinum! 
I always had this problem with "included" pages in Cold Fusion, and this
would be such a simple way to overcome that. 
+1


BTW - for all the folks worried about templates looking JSP-ish, I
wouldn't worry too much.

I estimate that in 90% of our templates, extra whitespace can be ignored
and so #output("off") (or #spaces_off or #gobblewhitespace("off")
<grin>) wouldn't be needed. But for the few times when whitespace is
realllly important, it can be explicitly output.

Cheers! :-)
Timo






--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message