[ZPT] Editing templates not affecting templates thats use
macros from it
Godefroid Chapelle
gotcha@swing.be
Thu, 22 Aug 2002 15:03:14 +0200
At 21:15 21/08/2002, Clint Brubakken wrote:
>If macros where expanded, it would gave me a tales error about </p> not
>matching the open tags. This same pt worked with the only macro, and the
>macro it self had no errors. The </p> it didn't like was the one of the
><p></p> pair that surround the <span metal:fill-slot ...>...</span>.
>
>
>I've even had pt's that display the new way, that when edited for other
>reasons give me the tal error above.
This looks like a wall I already have bumped.
What I did not know is that the HTML parser checks for valid HTML
constructs : for example it will refuse
a <p><div>something</div></p> as it is invalid for HTML 4 (?).
I am trying to infer from what you tell us above and have the feeling that
you may be producing invalid HTML through the use of the metal slots. IOW
can you check that you are not provoking situations like the refused I
describe.
I made some tests to check if this idea could be related to your problem
and found out what follows.
It is easy to reproduce the following comportment :
define two page templates with no macro expansion.
1) master :
<html metal:define-macro="page">
<body>
<p><span metal:define-slot="slot"/></p>
</body>
</html>
2) user :
<html metal:use-macro="here/master/macros/page">
<div metal:fill-slot="slot">The slot</div>
</html>
If you do not expand, the rendering of user will work (no Zope error) and
produces invalid (?) HTML :
<html>
<body>
<p><div>The slot</div></p>
</body>
</html>
If you choose to expand macros in "user" page template, it gives you the
following back
<html metal:use-macro="here/master/macros/page">
<body>
<p><div metal:fill-slot="slot">The slot</div></p>
</body>
</html>
The rendering of "user" page template still works (no Zope error) and
produces invalid (?) HTML.
If later you save any changes to "user" page template, you receive the
following error message:
Compilation failed
TAL.HTMLTALParser.NestingError: Open tags <html>, <body> do not match close
tag </p>, at line 4, column 46
!!!!!!!!! It is important to remark that the expansion alone do not
generate any error message. !!!!!!!!!!
To the community : is this something which should be added to the collector
as a bug ?
IMHO yes, the comportment should be coherent and give an error when expanding.
--
Godefroid Chapelle
BubbleNet sprl
rue Victor Horta, 18 / 202
1348 Louvain-la-Neuve
Belgium
Tel + 32 (10) 459901
Mob + 32 (477) 363942
TVA 467 093 008
RC Niv 49849