You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Jason Pettiss <ja...@TheCatalis.com> on 2005/08/14 23:57:06 UTC

Configuring loop counter on a per-template basis

It's really a powerful feature to be able to control the name of the 
loop counter variable.  But it's always annoyed me that I can't take a 
template that someone else has written and deploy it on my server 
without first mucking with it.  Because the loop counter name is set 
server-wide, but is used on a per-template basis.  Wouldn't it be nice 
to be able to have a page definition which says on the template itself, 
what the loop counter will be?

#define( counter.name = 'loopIndex' )
#define( counter.initial.value = 1 )

Then any template written somewhere will work somewhere else.  But 
imagine this:

#define( whitespace.gobble = 'none' )
   whitespace is really sensitive in here,
i wish  velocity wouldn't gobble it up
#define( whitespace.gobble = 'all' )
    but here it's not, in fact, it'd be nice
if     all redundant whitespace just      disappeared ;-)

That'd be super cool.  And I imagine it would simplify the parser 
grammar a bit, which could be written to treat all whitespace as 
sacrosanct, and instead whitespace could be handled with a 
post-processor of some sort.


Anyway, just a thought.

Jason Pettiss
TheCatalis.com



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