[Zope3-dev] <script> - the anti-pattern

Paul Winkler pw_lists at slinkp.com
Wed Sep 10 16:21:36 EDT 2003


On Wed, Sep 10, 2003 at 12:39:24PM -0400, Phillip J. Eby wrote:
> Visual parameters.  In your example, 'bit_of_code' has no access to the 
> *original* content of the <foo> block.  To illustrate, here's an example 
> use of a hypothetical "selected-list" component:
> 
> PEAK syntax
> -----------
> <ul pwt:domlet="selected-list:something">
>     <li>This item is just an example and will not show up in the output</li>
>     <li pwt:define="unselected">This is how an unselected item is 
> rendered</li>
>     <li pwt:define="selected"><b>This is how the selected item is 
> rendered</b></li>
>     <li>This item is just an example and will not show up in the output</li>
> </ul>
(snip)
> Regardless of how you spell it, the hypothetical "selected-list" component 
> would be instantiated and given the containing DOM nodes (or DOMlets) as 
> its contents.

Very very interesting. I like the look of it. But I'm a bit 
confused. The selected-list instance gets the whole <ul> 
node including all its child nodes? 

And I gather the selected-list has a sequence of text streams, 
which are somehow marked "selected" or "unselected". 
And somehow it figures out that you want the selected
text to go inside the <b> tag? How? What if I had this:

 <li pwt:define="selected"><b>This</b> is how the selected item is 
 rendered</li>

What happens there?

Also, what might simple code for selected-list look like?

I had a look at the code URLs you provided, but the answers were not
clear to me.

-- 

Paul Winkler
http://www.slinkp.com




More information about the Zope3-dev mailing list