Re: weird macro params issue
Ioannis Cherouvim <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hello again
I know it's a corner case, and maybe a cryptic way of defining
templates, but here is how I actually use it:
<#macro renderLink url anchor=url title=anchor>
<a href="${url}" title="${title}">${anchor}</a>
</#macro>
This provides full flexibility for the client code of the renderLink
macro which has sensible defaults.
All the following produce nice results:
<@renderLink "http://freemarker.sourceforge.net/" />
<@renderLink "http://freemarker.sourceforge.net/" "FreeMarker" />
<@renderLink "http://freemarker.sourceforge.net/" "FreeMarker"
"FreeMarker: Java Template Engine Library" />
Of course I could rewrite the macro definition and implement the same
behavior with a couple of <#if /> and <#local /> inside it.
thanks
Jonathan Revusky wrote:
>
> I mean, seriously, is this coding pattern actually useful?
>
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone