On 27 Sep 2010, at 22:22, Piotr Kroczyński wrote: > > After clone PHPTAL stripped doctype... Why ?
Thanks for the test case — it was very helpful. Short story: it's a bug. Long story: PHPTAL stores template state in nested PHPTAL_Context objects (tal:define, tal:repeat, macro calls, etc. create nested contexts). Clone of PHPTAL creates nested context too, which keeps reference to previous context. This makes new PHPTAL object behave like macro running in the old one (in fact that's how macros are executed). So the problem is that cloned PHPTAL tries to set DOCTYPE in outermost context, which happens to be still in the previous PHPTAL object. I've added quick'n'dirty fix for it in SVN (by setting DOCTYPE in two places). Proper fix might need some refactoring to eliminate cloning of PHPTAL in macro calls :( > When I change output mode to HTML5, PHPTAL generates broken html (no quotes > around attributes values, does not matter if after clone or before) and does > not change/validate doctype in layout.html. Is this normal? Do you mean it's broken according to HTML5 specification, or broken because it doesn't look like XML? In HTML5 mode omitting of quotes is intentional and PHPTAL should omit them only in cases permitted in HTML5 text/html syntax. PHPTAL also is supposed to force DOCTYPE to be the only one allowed in HTML5 (so you could have well-formed XHTML/1 with named entities as input and HTML5 as output). If it doesn't do that, then I'd like to see a test case for it. -- regards, Kornel _______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal