[ZPT] Should tal:content keep surrounding tags?

Brad Clements bkc@murkworks.com
Fri, 1 Jun 2001 13:56:46 -0400


On 1 Jun 2001, at 13:29, Jim Fulton wrote:

> > >   A. Define tal:content so that it includes "surrounding" tags.
> > 
> > For some reason I don't like this idea, but I don't know why. Maybe there's an
> > interaction with macros?
> 
> My first reaction was negative, but it has grown on me. Part of the justification
> is that I don't think of tags as content, so saying that in:
> 
>   <td><font color="white"><font size="+1"><i>splat</i></font></font></td>
> 
> the content to be replaces is "splat" feels easonable.

So you're saying that tal:content will recurse childNodes until it reaches the end,  
replace the text of that node, then output all of the recursed nodes?

What about this?

   <td ta:content="here/splat">
        <font color="white"><font size="+1"><i>splat</i><br />more text
        </font></font>
    </td>

I'm not so much concerned with "more text", but the <br /> which could be <hr />



> > <td tal:content:deep="here/splat">
> 
> Why the extra colon? This looks too odd to me.

Yes, it's called a brain-o. Sorta like a typ-o, but happens higher up in the processor.

> > I still need a way to have a repeat that does NOT include the enclosing element.
> 
> What would be an example of this?


I've posted two messages in the past 2 weeks about this.

On may 27th,


> I need to apply a single condition test to a static element and a loop.
> 
> Here's what I have:
> 
> <span tal:define="wt here/WoodTypes"
>    tal:condition="python:'soft' in wt">
> <h3>Soft Wood Types</h3>
> <span tal:repeat="typ here/SoftWoodTypes" 
>       tal:replace="structure string:$typ<br />">ficklmire</span>
> </span>
> 
> 
> Two uglies with this
> 
> 1. The outer span remains in the html. What I'd like is something like
> 
>  tal:replace="structure contents"
> 
> In the outer span so that it's not included in the output. "contents" means the children of 
> this html element.
> 
> 
> 
> 2. see the ugly use of 
> 
> tal:replace="structure string:$typ<br />"
> 
> I wish there was a better way to do this, though I'm not sure what. I had previously used 
> a span as the repeat, but again I couldn't eliminate the outer span .. it was ugly.
> 
> If I had a tal:replace="structure contents"  then that would fix this.
> 
> Perhaps I'm missing something?


And 


> I'm still looking for a way to have a tal:repeat that does NOT include the enclosing 
> element.
> 
> Like
> 
> <span tal:repeat="item in items">
>     <h1 tal:content="repeat/item/title">The title</h1>
>     <p tal:content="repeat/item/description">The description</p><br />
> </span>
> 
> The idea is that I don't want the outer <span> to be in the output, just
> 
> <h1>The title</h1>
> <p>Descrption</p><br />
> 
> (bad example but you get the idea)
>