[ZPT] Authoring tools and tag-nesting problems
Guido van Rossum
guido@digicool.com
Thu, 05 Apr 2001 16:55:14 -0500
> I've encountered a problem with using authoring tools to style ZPT
> documents.
>
> I had a template with the following snippet:
>
> <b tal:content="container/name">Joe</b>
>
> When I edited this template in Dreamweaver UltraDev and applied a
> subtle shade of pink to "Joe", I found that the resulting HTML was:
>
> <b tal:content="container/name"><font color="#FF0080">Joe</font></b>
>
> That is, Dreamweaver applied the <font> tag just to "Joe" and not
> around the bold tags enclosing the text (other authoring tools may well
> do the same, and I'm not sure we could say wrongly). This means that
> when the template is rendered, the <font> tag ends up being lost when
> it (and not just "Joe") gets replaced by the value of "container/name".
>
> Other than subsequently tweaking the HTML code manually (but doesn't
> that defeat one of the goals of ZPT?), how can we be sure that the TAL
> statements will be on the appropriate (i.e. innermost) tag after
> compound styling has been applied? Or is there a way to have a
> "tal:content" statement affect only the innermost content? And if not,
> ought there to be?
>
> Hamish Lawson
Thanks -- that's an interesting real-life observation. I think there
may be no easy answer, but you could try to put the TAL attributes on
a <span> tag *inside* the <b><font> elements...
--Guido van Rossum (home page: http://www.python.org/~guido/)