Hi Jonathan,
since you are eager to understand how Velocity is progressing, you can
see that Velocity is not a one-man-thing, but a team of lead developers
and other contributors spending some of their time to test patches,
implement requested features and to answer user questions on the
mailing lists. One main goal seems to be the do-it-right and professionally
(with a slower progress than in the main bread-and-butter jobs), as well
as ensuring backward compatibility.
The fact that Velocity has a large user comunity lies on the simplyness
and beauty of the approach. It is very useful as it is. Some enhancement
would raise its usefullenss, and these are finding its way in, mostly
in a BC form.
The proposal for the whitespace gobbling for structured templates was
made by me in 2001. The escence was finally taken up into an issue
http://issues.apache.org/jira/browse/VELOCITY-253
And the different approches and community requets where summarized
in the wiki:
http://wiki.apache.org/jakarta-velocity/VelocityWhitespaceGobbling
With the scheduling features in Jira and Will having taken the lead,
it has been scheduled for a 2.0 release when some non-BC formatting
changes would be possible.
I also suggested that the parser should not gobble any whitespaces,
and then add a postprocesor to the AST implementing the desired/configured
gobbling schema!
The implementation for such a change is far from trivial, being a rework
of the parser, and will affect BC.
It is an open community, and anyone who is interested can jump in
and supply a patch.
Personally, if someone reworks the parser to be non-whitespace-gobbling,
I would be eager to then provide the structured template gobbling
implementation patch!
:) Christoph Reck
Jonathan Revusky wrote:
Christoph Reck wrote:
Hi,
the whitespace issue has been debated quite a lot, and we have a
consensus in this list that we will implement in the future a
gobble-none and a gobble-structured form;
That is interesting to hear, Christoph.
I'm still a bit vague on the details.
When did all this debate occur?
What is currently the status of implementing this? Has somebody been
assigned ownership of the issue?
Is there some roadmap which says approximately when a future Velocity
will have this? (I do not recall it being in the list of things to be in
1.5.)
<snip>
#if $(user.isAuthorized)#*
*#Hello#*
*##else#*
*#Good Bye#**
**##end
that's what I'm doing sometimes now, and it's yuck to mainatin!
Well, I sympathize with that, it really seems terrible to me. OTOH, are
you obliged to use Velocity for these purposes, company policy or
something?
Because if not, obviously, obviously I know of one better alternative
available. (Guess which one? ;-)) But there may be others. I have not
done a survey of the template engine field recently.
But is this reasonable?
Again, the fact that it is possible to achieve precise control of
whitespace is not the key point. It is that you want such control
while having a reasonable, human-readable template. That is the
raison d'ĂȘtre of templates really.
Okay, I guess no Revusky posting would be complete without a
FreeMarker plug. The FreeMarker solution was to introduce whitespace
trimming directives that are applied at parse-time.
So, in FreeMarker, you could write:
<#if user.isAuthorized>
Hello<#t>
<#else>
Good Bye<#t>
</#if>
That is exactly in the line of:
http://wiki.apache.org/jakarta-velocity/VelocityWhitespaceGobbleStructuredTemplates
Well, except that there is an important practical difference: this is
the way FreeMarker actually works, has been working for the last couple
of years at least. Meanwhile, you are pointing to a document that says:
"wouldn't it be nice if Velocity worked this way?" It is a significant
difference in particular when somebody needs this to be working today,
not at some unspecified date in the future.
Earlier, I probably infuriated people here by saying that "if you talk
the talk, you should walk the walk." But this issue seems like yet
another case in point. If, in the Velocity community, for all the talk
or debate, there is not the gumption to sit down and do the work of
implementing badly needed functionality, and if, in our community, we
have done the work of implementing the feature that many people need,
why should I refrain from telling people this when they specifically
query about this? Especially when many people who could benefit from our
work may not be aware of it?
So, when I have said that if you guys talk the talk, you should walk the
walk, you do see my point, don't you?
It seems fair to say that, at least for people who have no significant
investment in Velocity, if they need or may need fine control of
whitespace, they should look elsewhere.
Would you disagree with that, Christoph?
Regards,
Jonathan Revusky
--
lead developer, FreeMarker project, http://freemarker.org/
The <#t> directives indicate that the opening and trailing whitespace
on the line is to be gobbled, i.e. it is there to make the template
human-readable. (There are also whitespace gobbling rules that say
that the if else and the closing tag, since they occur solely on a
line with no other whitespace output, gobble their opening and
closing whitespace.)
[snip]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]