velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dekany <>
Subject Re[2]: Whitespace, redux
Date Fri, 19 Apr 2002 10:29:27 GMT
Friday, April 19, 2002, 10:44:46 AM, Christoph Reck wrote:

> Daniel Dekany wrote:
>> Some more explanation. The idea is that "non-visual" entities (flow
>> control, etc) are whitespace eaters, while "visual" entities are not.
>> Eg. if you have a <LI>-like entity, you want it not to eat
>> whitespace:
>> <UL>
>>   #li("Male")
>>   #li("Female")
>>   #li("Neither")
>> </UL>

> The rule with "Directive+" or just "Directive" would output the same:

There is little misuderstading here. The whole "some more explanation"
part of the mail was not about how "Directive+ preforms better as
Directive in velocity", but about what do I think about whitespace
gobbling. So the point is that you want to gobble whitespace in a line
if you have there non-visual entities only, and you don't want to
gobble whitespace if you have visual entities too.

>   <UL>
>     #indented()#li("Male")
>     #indented()#li("Female")
>     #indented()#li("Neither")
>   </UL>
> and the latter would not work with the "Directive+" rule.

This is a hack, which exploits an (IMO illogical) consequence of
"Directive". This is a case where "Directive" happens accidentally
work better. If you have something like this:


then nobody will belive that it will indent. And if you have a
dedicated directive to indent, then would not be cleaner to say
instead of Directive+ that NonIndentedDirective+?

But if you really need this hack, then if #indented is a Velocymacro
call, then your example will work with Directive+ too!

> I mean: if "Directive+" greedingly gobbles whitespaces, how do you stop it?
> OK, an #echo(...) could explicetely be used.
> But look at my example above how I believe it could be handled when 
> just "Directive" applies.

I don't understand what you mean. Neither line above will gobbles
whitespace. Note that #foo above is a vm.


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

View raw message