You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christoph Reck <Ch...@dlr.de> on 2000/09/07 16:26:53 UTC
Design issues
as reply to docs/wm-notes and specification/question from Jason.
to docs/wm-notes:
A) in a separate email I'm going to send a code snippet that may
be useful for the introspection engine.
B) using the '#' marker for keywords and avoiding {}s.
* Wasn't this one of the velocity beeing a better parser issue
because it allowed clean handling of markup sections?
* anyway a '#' together with begin and end markers should not
conflicht with XML (as I read the XML spec) as long as no
ampersand preceeds the hatchet.
* alternatively velocity could use '$' to prefix markup, but
it may look strange `$if ($foo) $foo $end` (btw. does WM/velocity
allow start+body+end markup in one line as above?
to specification/question:
1) #foreach $element
* The way WM handles it is good.
* alternately velocity could reuse the element if it
has been defined previously, thus overweiting its content.
After the loop, the element would contain the last item.
If the element was only defined within the loop, it could
dissapear after the loop.
This would avoid the push/pop of the previous value, but
probably is just as much if'ing as the WM approach.
2) #if ($variable)
* the WM approach is perfect.
3) $nullValue
* if the context cannot be resolved, it should emit the complete
macro text (here "$nullValue")
* if the value contained is null, then print "null" or "$nullValue"
-> to avoid printing a variable that may be null use
"#if ($variable) $variable #end"
(see the code snippet introspection code in a next email)
Please let me know it the previous code-snippet in the email
"org.apache.velocity.Util.invoke(...) enhancement" was usefull.
I didn't see the changes go into the current CVS checkin.
Cheers,
Christoph