Mercurial > genshi > mirror
comparison doc/text-templates.txt @ 394:cab6b0256019 trunk
Minor doc fixes.
author | cmlenz |
---|---|
date | Thu, 28 Dec 2006 17:50:40 +0000 |
parents | 6951db75824e |
children | 691dd56c0dd0 3eb30e4ece8c |
comparison
equal
deleted
inserted
replaced
393:1dc3d3df4a85 | 394:cab6b0256019 |
---|---|
70 template data. Expressions need to prefixed with a dollar sign (``$``) and | 70 template data. Expressions need to prefixed with a dollar sign (``$``) and |
71 usually enclosed in curly braces (``{…}``). | 71 usually enclosed in curly braces (``{…}``). |
72 | 72 |
73 .. _python: http://www.python.org/ | 73 .. _python: http://www.python.org/ |
74 | 74 |
75 If the expression starts with a letter and contains only letters and digits, | 75 If the expression starts with a letter and contains only letters, digits, dots, |
76 the curly braces may be omitted. In all other cases, the braces are required | 76 and underscores, the curly braces may be omitted. In all other cases, the |
77 so that the template processors knows where the expression ends:: | 77 braces are required so that the template processor knows where the expression |
78 ends:: | |
78 | 79 |
79 >>> from genshi.template import TextTemplate | 80 >>> from genshi.template import TextTemplate |
80 >>> tmpl = TextTemplate('${items[0].capitalize()} item') | 81 >>> tmpl = TextTemplate('${items[0].capitalize()} item') |
81 >>> print tmpl.generate(items=['first', 'second']) | 82 >>> print tmpl.generate(items=['first', 'second']) |
82 First item | 83 First item |