Re: [Templates] setting macro parameters at run time

[prev] [thread] [next] [Date index for 2004/06/18]

From: Jens Porup
Subject: Re: [Templates] setting macro parameters at run time
Date: 06:41 on 18 Jun 2004
On Fri, Jun 18, 2004 at 04:06:31PM +1000, Jens Porup wrote:
> On Fri, Jun 18, 2004 at 01:52:50AM -0400, Mark Mills wrote:
> > Jens Porup wrote:
> > >Is there a way to set the parameters to a macro at run time?
> > >
> > >So I have a macro like so:
> > >
> > >	[%- MACRO foo(bar,baz) BLOCK -%]
> > >	[%# do some stuff here %]
> > >	[%- END -%]
> > >
> > >But I want to call the macro like so:
> > >
> > >	<td>foo(bar="blah", baz= "blah" _ [% ANOTHER_VARIABLE %])</td>
> > 
> > I think you'd want to do this:
> > 
> > [% tempbaz = "blah" _ ANOTHER_VARIABLE %]
> > <td>[% foo(bar="blah", baz=tempbaz) %]</td>
> > 
> > The parser doesn't much like inline string construction in calls, you 
> > normally need to build the argument first in a single variable and then 
> > pass that.
> 
> I've tried that:

The bug was a typo. 

Apologies for the extraneous posts.

Jens


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] setting macro parameters at run time
Jens Porup 06:41 on 18 Jun 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52