logo       

Re: html macro library: msg#00181

jakarta.velocity.user

Subject: Re: html macro library

Kevin Bolton wrote:
Has anyone developed a macro library for standard html items? For
example:
#macro (html_href $link $text)

<a href='$link'>$text</a>

I don't know whether anybody has developed such a library for Velocity, but it seems to me that, unless the macros could be applied recursively, such a library would be of very limited use-value. Unfortunately, Velocimacros have design problems or limitations that prevent this.

You see, to be generally useful, a block-oriented HTML generating macro would have to be able to take a block (containing potentially other template directives) as its parameter. That is your $text parameter in the above.

FYI, at least one other template engine does afford this possibility. FreeMarker has had the ability to define macros with associated blocks since version 2.2.

If the Velocity community does resume active development of the template engine, then the above kind of feature is probably well worth lobbying them for.

Best Regards,

Jonathan Revusky
--
lead developer, FreeMarker project, http://freemarker.org/
FreeMarker vs. Velocity comparison page: http://freemarker.org/fmVsVel.html

FreeMarker 2.3 preview 1 is out! :-)




#end
--------------------
Kevin Bolton
Paychex Inc (585) 216-0808
<mailto:kbolton@paychex>


-----------------------------------------
The information contained in this message may be privileged, confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or any employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer.
Thank you. Paychex, Inc.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise