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.
hypothetical example....
##define a macro to 'bold' the output text in bold.vm
#macro (bolder $text)
<b>$text</b>
#end
actual template.....
Template (foo.vm)
#parse ('bold.vm')
<html>
#bolder ('welcome john doe')
#foreach
<!--print some list of items and items themselves contain #bolder
(sometext) -->
#end
</html>
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 ?
Thanks for your time.
--
Arvind
Regards
Thanks - I think i failed to add that - #bolder ('welcome john doe')
works perfectly ok in the example specified above.
What fails however is as follows...let us consider the example of a
vector of colors am printing out - and the colors can be
entered/maintained by the user....
i.e. the user maintains, red, blue, #bolder ('green'), black, #bolder
('yellow') - expecting that the list when printed, would contain the
text green and yellow in bold..(as per the macro behavior)
When velocity engine runs thru the list....it prints them as specified
by the user....however, we would rather that, velocity engine, wait for
the output, which would now contain, some more velocity templates/macro
references and do one-more pass...
Hope i made myself clear ?
--
Arvind