Mercurial > genshi > genshi-test
comparison doc/text-templates.txt @ 394:ebc7c1a3bc4d
Minor doc fixes.
author | cmlenz |
---|---|
date | Thu, 28 Dec 2006 17:50:40 +0000 |
parents | 7ae694e7462e |
children | 6911f3c5a7e8 0742f421caba |
comparison
equal
deleted
inserted
replaced
393:a056613621ab | 394:ebc7c1a3bc4d |
---|---|
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 |