Thank you for your prompt response Bill,

How exactly do I write this directive?
I dont undestand how it would be used...

Is it instead of the #macro directive???

Also the parsing of macros right now does not include the '#end' tag, it is
like a simple line directive. Do you think it would be posible to
diferentiate macros defined with a new directive (say #macrowb -a macro with
body) that assigns to its macros the property of accepting child nodes
during parse time?

Would you join me if I start developing this?

Do you think it is possible?

Do you think it is simple to do?

best regards,
Dario.

PD: Perhaps a simpler startup is to have a simple directive that catches all
its content and puts it in a string. Say:

#text into $mystr until '---end---'
here code or anything
---end---

so with this simple directive I could perform a parse on runtime and even
cache the internal representation in a hashTable according to filename and
linenumber.

Then it is just a matter of naming things or alike so to have this variable
accesible from within any VM.

What do you think?


----- Original Message -----
From: "Bill Burton" <[EMAIL PROTECTED]>
To: "Velocity Developers List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 14:45
Subject: Re: VM body node execution


> Hello,
>
> Dario Liberman wrote:
> > Hello,
> >
> > I am new to velocity, I am from the near webmacro world. :-)
> >
> > I was thinking about migrating to Velocity.
> > And when I came to the VMs I found it interesting, but would like to
> > increment its expressive power now that I got tempted to use it.
> > The improvement goes subject to this question:
> >     I would like to have access inside a VM to the body node of the
macro's
> > callee, is it possible?
> >
> >
> > I am new to this, and I would like to accomplish it if it is possible.
Is
> > there any guru that can help me out?
> >
> > Any comments are welcome.
> >
> > Here I describe what uses I would be giving to it, with examples, so
that I
> > can explain myself.
> >
> > for example:
> >
> > code->
> > #macro( tostring $strvar )
> >     #set ( $strvar = "$macro_body")  ## this would do a kind of
> > Velocity.execute($current_context, new
> > stringwriter(req.get("$strvar")),macro_body_node)
> > #end
> > <-code
> >
> > so when I use it:
> > code->
> > #tostring ( $mystrvar)
> >     VM code here, with any statements, directives, etc.
> > #end
>
> The problem is macros can't have a body when being executed :( .  It
> would be *really* nice if there were a way to do this.  Right now, you
> would have to write a directive in order access the body.
>
> -Bill
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to