velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Avoiding whitespace
Date Mon, 31 Oct 2011 15:45:22 GMT
In that case, the documentation is wrong.  Leading whitespace is only
trimmed from in front of a #set directive that has nothing after it.
I'm not aware of any other case where leading whitespace is trimmed.

On Mon, Oct 31, 2011 at 7:29 AM, Christopher Schultz
<chris@christopherschultz.net> wrote:
> All,
>
> The User Guide says that "Velocity's behavior is to gobble-up excess
> whitespace" and offers this example:
>
> Velocity's behaviour is to gobble up excess whitespace. The preceding
> directive can be written as:
>
> "
> Send me
> #set( $foo = ["$10 and ","a pie"] )
> #foreach( $a in $foo )
> $a
> #end
> please.
>
> or as
>
> Send me
> #set($foo       = ["$10 and ","a pie"])
>                 #foreach           ($a in $foo )$a
>         #end please.
>
> In each case the output will be the same.
> "
>
> I'm not observing this behavior. In my templates, the trailing
> whitespace after a directive on a line (usually just a newline) appears
> to be trimmed, but leading whitespace is preserved. So, the output from
> the second example looks like this:
>
> Send me
>                 $10 and
>         a pie
>          please.
>
> (note the leading whitespace before "$10 and", etc. which you may not be
> able to see if you are viewing this message in HTML mode).
>
> Am I missing some kind of configuration parameter? I don't appear to
> have anything in my configuration that has anything to do with whitespace.
>
> Is the documentation wrong? Or am I just mis-reading it?
>
> I know the issue of whitespace comes-up a lot, and I'm sorry to add to
> the never-ending discussion.
>
> Thanks,
> -chris
>
>

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


Mime
View raw message