[Petal] [IDEA] Hash with params
Jean-Michel Hiver
jhiver at mkdoc.com
Wed Sep 10 23:00:45 BST 2003
> It was a rather half-assed way of doing a specific thing that prefixes
> nicely generalize. With prefixes, the above can be written as
> "/path/with/var:variable".
Gotcha! Brilliant idea. Now that I understand what it is about, I think
it'll be rather easy to implement with Petal. You'll be able to stack
prefixes too, which is a Petal feature suggested by William some time
ago.
It would be nice if this prefix business allowed parameters to be passed
to methods, functionality which I find very useful. I would really like
some kind of formal syntax allowing this kind of stuff in TALES. I guess
prefixes in paths is a nice step in the right direction!
Now some stuff about METAL. I'm still super-confused I am afraid :)
Am I right in seeing METAL as some kind of 'meta-template'?
As far as I can see, define-slot is only really some sort of
'tal:define_variable_with_current_xml_node' while fill-slot boils down
to a 'tal:replace_structure_unless_not_defined'.
define-macro serves as an indentifier. Which makes me think: Why not use
a more standard syntax for XML / HTML fragments in URLs when you do
includes? (i.e. use-macro="my/file.xml#mymacro").
and use-macro is just an include statement, except that it defines all
the fill-slot variables before doing the includes.
Have I got it right?
If / When this is implemented with Petal, the following macro should be
possible:
<ul tal:define="child self/root">
<li metal:define-macro="sitemap_li">
<a
href="#"
hreflang="en"
lang="en"
xml:lang="en"
tal:attributes="href child/Full_Path;
hreflang child/Lang;
lang child/Lang;
xml:lang child/Lang"
tal:content="child/Title"
>Child Document Title</a>
<ul
petal:define="children child/Children"
petal:condition="children"
petal:repeat="child children"
>
<li metal:use-macro="#sitemap_li" />
</ul>
</li>
</ul>
Cheers,
Jean-Michel.
More information about the Petal
mailing list