On Thu, Jan 05, 2006 at 12:54:33PM +0100, Christoph Zwerschke wrote:
> 
> This is because the input is required to be xml, even if you want to 
> serialize 
> as html.
> 
> Additional problem: Even if you put the Javascript in a CDATA block, it is 
> automatically escaped and the Javascript will not run either.
> 
> In a comment to ticket #99, somebody claimed that the Javascript comes out ok 
> if you serialize as html, but this does not seem to be true.
> 

That was me and in the svn trunk this is true. Since I don't think I
made any changes that would make this work, it should be OK in 0.8.
An example:

    $ cat /tmp/junk.kid 
    <html xmlns:py="http://purl.org/kid/ns#";>
    <script type="text/javascript">
    <![CDATA[
        for (var i = 0; i < 10; i++) { } 
    ]]>
    </script>
    </html>
    $ python -c 'import kid;print 
kid.Template(file="/tmp/junk.kid").serialize(output="html")'
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd";>
    <HTML>
    <SCRIPT TYPE="text/javascript">

        for (var i = 0; i < 10; i++) { } 

        </SCRIPT>
        </HTML>

Do you get different results?

[snip]

> I agree with Ryan that we cannot do much here as long as we want to keep 
> input 
> (template source) well-formed and that there are good reasons to do this.
> 
> But I think something we can do is point these issues out more clearly in the 
> FAQ and user guide.

Yes I agree. In order to win over more people we will have to
improve the documentation.

David

-- 
GPG keyID #6272EDAF on http://pgp.mit.edu
Key fingerprint = 8BAA 7E11 8856 E148 6833  655A 92E2 3E00 6272 EDAF

Attachment: pgp5icISlTQmr.pgp
Description: PGP signature

Reply via email to