Yuval Kogman | 7 Jun 02:57

METAL with TAL inside

Hi,

In the effort of creating Maypole::View::Petal, I'm breaking my head
over a transliteration of the orginal template toolkit templates to
Petal.

There is extensive use of macros in the TT code, which I guess is a good
thing. I attempted to keep the templates pretty much 1:1 where possible,
but I'm now stuck.

Here is an example template:

<span metal:define-macro="display_line">
	<span tal:repeat="col classmetadata/colums" tal:omit-tag="string:1">
		<td tal:condition="false: equal:col id">
			<?if name="equal:col url"?>
				<a tal:attr="href item/url" tal:content="item/url"/>
...

It gives

	<span tal:repeat="col classmetadata/colums" tal:omit-tag="string:1">
		<td tal:condition="false: equal:col id">
			
				<a tal:attr="href item/url" tal:content="item/url"></a>
			
		</td>
	...

and so on as the output to the browser.
(Continue reading)

Jean-Michel Hiver | 7 Jun 08:29

Re: METAL with TAL inside

Yuval Kogman wrote:
> Hi,
> 
> In the effort of creating Maypole::View::Petal, I'm breaking my head
> over a transliteration of the orginal template toolkit templates to
> Petal.

Cool :-)

> There is extensive use of macros in the TT code, which I guess is a good
> thing. I attempted to keep the templates pretty much 1:1 where possible,
> but I'm now stuck.
> 
> 
> Here is an example template:
> 
> <span metal:define-macro="display_line">
> 	<span tal:repeat="col classmetadata/colums" tal:omit-tag="string:1">
> 		<td tal:condition="false: equal:col id">
> 			<?if name="equal:col url"?>
> 				<a tal:attr="href item/url" tal:content="item/url"/>
> ...

It which file do you define this macro?

> It gives
> 
> 	<span tal:repeat="col classmetadata/colums" tal:omit-tag="string:1">
> 		<td tal:condition="false: equal:col id">
> 			
(Continue reading)

Yuval Kogman | 7 Jun 14:47

Re: METAL with TAL inside

On Mon, Jun 07, 2004 at 07:29:24 +0100, Jean-Michel Hiver wrote:

> If you don't declare the Petal namespace, the prefix by default is 
> petal:, not tal:

Turns out this was it.. I assumed the tal prefix would inherit from the
main document... It's less to type, so... =P

> This will not work. Petal's implementation of METAL is only partial, and 
> you need to read the docs :)

funny, it does work... =)

The file is called "macros", and the macro is called "display_line", so
it's not all that naughty.

Now all I need is to work around using TALES that look like
"object/laadidaa/?var" and get the var to interpolate before the path
expansion. I think using ${var} syntax is very ingruiging, because in

--

-- 
 ()  Yuval Kogman <nothingmuch@...> 0xEBD27418  perl hacker &
 /\  kung foo master: /me kicks %s on the nose: neeyah!!!!!!!!!!!!!!!!!


Gmane