Chameleon is based on Zope Page Templates , so if you don't have enough documentation for Chameleon, you can check out the zpt docs.
, . tal: replace tal: content, . structure , , , , . :
s = '''
<html>
<head>
</head>
<body>
<div tal:content="structure t">
</div>
</body>
</html>
'''
from chameleon import PageTemplate
pt = PageTemplate(s)
print pt(t='<p>Hi!</p>')
tal: replace tal: content, , Chameleon ( , __html__, ). , "", :
a = '''
<html>
<head>
</head>
<body>
<div>
${t}
</div>
</body>
</html>
'''
from chameleon import PageTemplate
pt = PageTemplate(a)
class Literal(object):
def __init__(self, s):
self.s =s
def __html__(self):
return self.s
print pt(t=Literal('<p>Hi!</p>'))