[ZPT] METAL: attributes as slots
Dieter Maurer
dieter@handshake.de
Wed, 12 Sep 2001 00:20:57 +0200 (CEST)
Chris Withers writes:
> How's this for a possible extension to METAL:
Good - almost perfect!
> In master_template:
> <html metal:define-marco="page">
> <html>
> <head>
> <link rel="stylesheet" type="text/css" href="/stylesheet.css"
> tal:replace="structure here/css_inline_or_link">
>
> </head>
> <body bgcolor="#ffffff" link="#000099" alink="#000099" vlink="#000099"
> metal:define-attribute-slot="bgcolor"
> metal:define-slot="body">
> Dummy body
> </body>
> </html>
>
> In a_page:
> <html metal_use-macro="here/master_template/page">
> <body metal:fill-attribute-slot="bgcolor string:#ccccff"
> metal:fill-slot="page">
> My real body
> </body>
> </html>
>
> What do other people think?
You need to specify how the "fill-attribute-slot" and "fill-slot"
interact.
Your example suggests that you first do "fill-slot" and
then *IN THE RESULT* "fill-attribute-slot" which is not
completely intuitive.
I personally would prefer an alternative solution:
Allow to override and extend a set of definitions in
a "define-slot" by that in the "fill-slot" (and similarly
for "define-macro" and "use-macro").
We need parameters (placeholder, slots) for different things
than element, for example for attributes, too.
I imagine to have something like this:
<XXX metal:define-macro="MMM" ...
tal:define="a ...;
b ...;
...
"
....
>
......
<XXX metal:use-macro="MMM" ...
tal:define="a ,,,;
c ,,,;
,,,;"
>
I feel, it would be good, if the definitions of the "use-macro"
were effectively appended to the definition list of the
"define-macro". This way, the "use" could override and
extend the definitions provided by the macro definition.
Dieter