velocity-user mailing list archives

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

> On 4/13/02 5:35 AM, "Joaquim Carvalho" <> 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. ;-)

And more recently from March 2002 (see #gobblewhitespace(off) )

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

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! :-)

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message