1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?python
def test2():
return 'test2'
test1 = 'test1'
?>
<testdoc xmlns:py="http://purl.org/kid/ns#">
<test>
<attempt py:content="test1">test with a module-level variable</attempt>
<expect>test1</expect>
</test>
<test>
<attempt py:content="test2()">test with a module-level function</attempt>
<expect>test2</expect>
</test>
<test>
<attempt py:content="None">test3</attempt>
<expect></expect>
</test>
<test>
<attempt py:content="'test4'">
<p>
<em>Here</em>'s some embedded structure too. This should not
show up in the output document.
</p>
<p>
This shouldn't either.
</p>
</attempt>
<expect>test4</expect>
</test>
<test>
<attempt py:content="1234">int test</attempt>
<expect>1234</expect>
</test>
<test>
<attempt py:content="1234.5678">float test</attempt>
<expect>1234.5678</expect>
</test>
<test>
<attempt py:content="'\xe2\x80\xa0\xc2\xa9\xe2\x80\x94'.decode('utf-8')">unicode test</attempt>
<expect>†©—</expect>
</test>
<test>
<attempt><![CDATA[quick < CDATA test]]></attempt>
<expect>quick < CDATA test</expect>
</test>
<test>
<!-- Check that xml:* attributes pass through properly. -->
<attempt><elm xml:lang="bla"/></attempt>
<expect><elm xml:lang="bla"/></expect>
</test>
</testdoc>
|