Will,
Sorry, i had failed to mention that #bolder ('welcome john doe') in the code
below works as expected though !
just that when, the list of colors get printed, it gets printed as plain
text....
do you still think, it is clubbed with the existing macro issues ?
--
Arvind
-----------------------------------------------------------
Will Glass-Husain
Thu, 27 Apr 2006 16:53:25 -0700
You cannot parse a file containing macros and have them work reliably in the
main page. See
http://wiki.apache.org/jakarta-velocity/MacroIssues
You can however collect all your macros together and put them in
VM_global_library.vm. All such macros will be loaded at initialization time.
See
http://jakarta.apache.org/velocity/docs/developer-guide.html#Velocity%20Configuration%20Keys%20and%20Values
WILL
P.S. As an aside, send followup or further questions to the users list please,
[EMAIL PROTECTED] Thanks!
||
Arvind Srinivasan wrote:
Sorry, if this has question of mine has been posted already - i am really
not
sure about the terminology used to search....
We are researching on usage of velocity at our place....we have setup
velocity with templates being loaded from databases, setup for using
the macros etc.
If the 'rendered' content has VTL code in it, I am curious, as to
how/whether we can support 'another pass' of velocity, ..as in,
user-generated content using system defined velocity macros.
example....
##define a macro to 'bold' the output text in bold.vm
#macro (bolder $text)
<b>$text</b>
#end
final template.....
Template (foo.vm)
-------------------
#parse ('bold.vm')
<html>
#bolder ('welcome john doe')
#foreach ($color in $colorlist)
$color (<!--pardon any syntax error - and assume the pseudo code works)
#end
</html>
The user maintains $colorlist (externally in a database as) red, blue,
#bolder
('green'), black, #bolder('yellow') - and the expectation is that the list
when
printed, would contain the text green and yellow in bold..(as per the
#bolder
macro behavior)
When the velocity engine is done with its work, #bolder (sometext) does
not get evaluated and it gets printed out as-is
This requirement is like the usage of macros in confluence (atlassian)
etc - just curious whether there are users who have used velocity for
this purpose. If there are - any best practises/things to watch out for
?
Are there other ways of handling such requirements ?
p.s : I have posted the same in google java groups and hope does not come
across as cross posting.
http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/4e934e5f2636c90e
---------------------------------------------------------------------
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]