[Petal] [IDEA] Hash with params
Steve Purkis
spurkis at mkdoc.com
Mon Sep 8 20:27:38 BST 2003
On Friday, September 5, 2003, at 08:44 pm, Evan Simpson wrote:
> Steve Purkis wrote:
>> $key => <span petal:replace="some/hash $key">hash key</span>
>> A similar argument would apply to Arrays:
>> list[$idx] = <span petal:replace="some/list $idx">hash key</span>
>
> I'm not sure how well this would apply to Petal, but ZPTs are now
> officially growing a path syntax extension that specifically deals
> with these cases. Examples of prefixed path segment usage are
> "some/hash/key:keystring" and "some/list/item:0". Apart from a set of
> built-in prefixes, they are defined with tal:define="prefix <prefix>
> <expression>". Generally, a prefix acts as either a function with two
> arguments or a namespace of single-argument functions. The examples
> above are of the first sort -- they take the current traversal object
> and a key or integer argument. An example of the second sort is the
> 'standard' prefix, which in ZPTs is a namespace of standard formatting
> functions, as in "some/number/standard:thousands_commas".
Interesting idea -- don't know what it would take to implement though.
And I assume it would be possible to define prefixes that variables as
arguments so that it would be possible to say "some/hash/key:somevar"
and "some/list/item:someindex"?
-Steve
More information about the Petal
mailing list