Mercurial > genshi > genshi-test
comparison doc/templates.txt @ 605:bc5faca93699
Text templates now default to rendering as plain text; it is no longer necessary to explicitly specify the "text" method to the `render()` or `serialize()` method of the generated markup stream. See tickets #62 and #118.
author | cmlenz |
---|---|
date | Mon, 27 Aug 2007 19:04:20 +0000 |
parents | 7145e4eba2ec |
children | 9ada030ad986 |
comparison
equal
deleted
inserted
replaced
604:6d1fa718794f | 605:bc5faca93699 |
---|---|
127 .. code-block:: pycon | 127 .. code-block:: pycon |
128 | 128 |
129 >>> from genshi.template import TextTemplate | 129 >>> from genshi.template import TextTemplate |
130 >>> tmpl = TextTemplate('Hello, $name!') | 130 >>> tmpl = TextTemplate('Hello, $name!') |
131 >>> stream = tmpl.generate(name='world') | 131 >>> stream = tmpl.generate(name='world') |
132 >>> print stream.render('text') | 132 >>> print stream |
133 Hello, world! | 133 Hello, world! |
134 | 134 |
135 .. note:: If you want to use text templates, you should consider using the | 135 .. note:: If you want to use text templates, you should consider using the |
136 ``NewTextTemplate`` class instead of simply ``TextTemplate``. See | 136 ``NewTextTemplate`` class instead of simply ``TextTemplate``. See |
137 the `Text Template Language`_ page. | 137 the `Text Template Language`_ page. |