velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dekany <>
Subject Re: Whitespace and Nitpicking
Date Sat, 08 Oct 2005 22:23:30 GMT
Saturday, October 8, 2005, 3:20:47 PM, Andrew Mason wrote:

> Can I just make a quick point on the whole whitespace issue. Velocity provides
> you with a couple of ways to handle your  own output. For example using
> String writers etc...I use a really nice set of classes called JTidy for HTML
> output, you can run your output through that and create perfectly tidy HTML
> (and valid if your designer isn't so talented). There is also nothing to stop
> you from writing your own cleaner for other languages where an implementation
> isn't already there. I can understand why people want these features in
> velocity, Yes it would be handy, yes it should be added as enough people want
> it, but I'm not sure it's as critical as many people make it out to be (i
> could be wrong). You are given methods to allow you to run the output through
> what ever classes you want. The only time where this may not work is when
> your doing servlets with the old VelocityServlet (i still don't use 
> VelocityViewServlet yet so the option maybe available in that too).

Sure, output with perfect white-space is certainly not achievable with a
general purpose text template languages (I mean without making the
templates horrible... lot of #* *# and like). They are inherently bad in
precisely control the white-space (WS from now), and since extra WS is
usually smaller problem that missing WS (at least in HTML/XML), they
rather output extra WS.

Still, there are some typical annoying superfluous WS generators, that
can be avoided with proper template language design. Like:



  #foreach(x in cx)
    - $x

In these cases it's obvious that you don't want the line-break, nor the
indentation spaces in the lines of the directives. So this are cases
where a template engine could give much less superfluous white-space.
OK, just less, not no extra WS. But, if possible to output less, why

Best regards,
 Daniel Dekany

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

View raw message