comparison doc/text-templates.txt @ 395:a81675590258 experimental-inline

inline branch: Merged [439:479/trunk].
author cmlenz
date Thu, 28 Dec 2006 18:17:10 +0000
parents 94639584725a
children 691dd56c0dd0 3eb30e4ece8c
comparison
equal deleted inserted replaced
359:e9101f20b796 395:a81675590258
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
Copyright (C) 2012-2017 Edgewall Software