You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Davide Mora <d_...@yahoo.com> on 2001/03/27 16:06:31 UTC

#parse()/#macro() problems

Hi!

i'm trying to include a common macro file in my
templates, for show you the problem i changed the
"app_example1".

I did this:

-- macros.vm -------
/* MACROS INCLUDED */
#macro (test $d)
 This is $d
#end
#test("inside!")
--------------------

-- example.vm -------
#parse("macros.vm")
#test("a bug ?")
#set( $this = "Velocity")
$this is great!
--------------------

-- output ----------
/* MACROS INCLUDED */
This is inside!
#test("a bug ?")
......
--------------------

i'm doing something wrong or it's a bug?
Davide

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

Re: #parse()/#macro() problems

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
That won't work until after 1.0 - because the inclusion is at runtime,
and the parser figures things out at parse time.

Will be fixed soon after 1.0.

Until then, just have the macros.vm file loaded at startup via the
library property (See dev doc...)

Will make a note of this in the docs.

geir


Davide Mora wrote:
> 
> Hi!
> 
> i'm trying to include a common macro file in my
> templates, for show you the problem i changed the
> "app_example1".
> 
> I did this:
> 
> -- macros.vm -------
> /* MACROS INCLUDED */
> #macro (test $d)
>  This is $d
> #end
> #test("inside!")
> --------------------
> 
> -- example.vm -------
> #parse("macros.vm")
> #test("a bug ?")
> #set( $this = "Velocity")
> $this is great!
> --------------------
> 
> -- output ----------
> /* MACROS INCLUDED */
> This is inside!
> #test("a bug ?")
> ......
> --------------------
> 
> i'm doing something wrong or it's a bug?
> Davide
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/?.refer=text

-- 
Geir Magnusson Jr.                               geirm@optonline.net
Developing for the web?  See http://jakarta.apache.org/velocity/