velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Whitespace, redux
Date Wed, 10 Apr 2002 00:14:30 GMT
On 4/9/02 7:58 PM, "Steven Hugg" <hugg@fasterlight.com> wrote:

> I thought the time was ripe to tackle the albatross that is whitespace
> handling, judging by the mail list archives :>  It is one of my big
> stumbling blocks with Velocity that prevents me from fully enjoying its
> charms.
> 
> It occurs to me that a very simple rule could be added to solve many
> whitespace problems:
> 
> * Given a text fragment between two directives, if it is entirely made up of
> whitespace, do not output that fragment.
> 
> This would let you do things like this:
> 
>   #if($fooCondition)
>       #**# whitespace tamed #**#
>   #end
> 
> Which would output " whitespace tamed ". If you omit the comments, it would
> read like "\n   whitespace tamed \n"

What if I *want* to output whitespace?

#if($fooCondition)  #include('foo.vm') whitespace tamed #parse('bar.vm')
#end


Now what?

> 
> Easy, and probably could be done without even touching the parser. Also nice
> because there is precedent -- I have never had a problem with whitespace
> behavior in XSL, which has a similar option for gobbling whitespace.

Oh, so it doesn't do it all the time ?  ;)

> 
> What does everyone think-- can we do it?

How about a switch?


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting

Maven & Gump are friends


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