velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rene Parra <rxpa...@yahoo.com>
Subject Velocimacro argument (by-name) passing
Date Thu, 15 Jul 2004 00:58:05 GMT

I've read the Velocimacro Miscellany section and have been able to get it to work.

Lets assume that we have #center and #bold defined (as is assumed in the user's guide).

Lets also say we have the following template:

<div>
    #center( "#bold('hello - 1st div')" )
</div>
<div>
    #center( "#bold('hello - 2nd div')" )
</div>

Now lets further say that I want to "abstract-away" the structure of the outside,
but have flexibility with the content of the inside:

#macro( reusableStruct $div1 $div2 )
<div>
 $div1
</div>
<div>
 $div2
</div>
end

How do I pass in the arguments for $div1 and $div2?
The following fails (because you can't double-quote a piece of VM code that already contains
a double-quote)

#reusableStruct( "#center( "#bold('hello - 1st div')" )"   "#center( "#bold('hello - 2nd div')"
)" )

Escaping the inner double-quote doesn't seem to help.

Any ideas?

		
---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message