Kevin Dangoor wrote: > > <P ALIGN="center"><IMG SRC="/tg_static/images/tg_under_the_hood.png"></P> > > </BODY> > > > > which is OK I guess, I just haven't learnt how to generate un-ecsaped > > content yest. > > py:replace="XML(greeting)" > > I like that Kid escapes by default. You just need to wrap the value in > an XML() call to get the unescaped version.
Thanks. I haven't reached the 'modules' part of Kid docs yet. > > However, there a strange thing happening when I try to do > > the same with the h1 element above: > > > > <body> > > <h1 py:replace="greeting">Hello, world!</h1> > > <span>controller greetings go here</span> > > </body> > > > > gives: > > > > <BODY> > > <SPAN>controller greetings go here</SPAN> > > <P ALIGN="center"> <IMG > > SRC="/tg_static/images/tg_under_the_hood.png"> </P> > > </BODY> > > > > Does anybody know what's happening there? I checked out TG r630 today, > > and I'm using Kid 0.8 and TurboKid 0.9.0 AFAIR. > > I'm not 100% sure why the tag is disappearing entirely in this case, > but I do know that what you want is py:content not py:replace. > py:replace completely removes the tag and replaces it with whatever > expression you give it... which, in this case, would yield an invalid > HTML file. py:content just replaces the contents of the tag but leaves > the tag there. Yes, I know I could use 'py:content', and this works in each case as far as I can tell. I'm not even sure I would ever need to use 'py:replace', I was just testing possibilities. And you're right - after wrapping the content passed from the controller in the XML() function it works every time. Thanks. Still, I think Kid's behaviour is inconsistent - replacing <h1> with an escaped string yields an HTML document that sems to me no more invalid than in the case of replacing <span>. Perhaps I'm missing something with respect to the structure generated in each case, but I can't see what it could be. Anyway, thanks a lot. > Kevin -- Grzegorz Staniak

