Mercurial > p > roundup > code
diff doc/customizing.txt @ 2857:53c0c18b59c6 maint-0.7
merge from HEAd
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 03 Nov 2004 02:57:37 +0000 |
| parents | 9e1c4c932323 |
| children | a204a49e0974 |
line wrap: on
line diff
--- a/doc/customizing.txt Tue Oct 26 07:59:28 2004 +0000 +++ b/doc/customizing.txt Wed Nov 03 02:57:37 2004 +0000 @@ -1337,7 +1337,10 @@ </tr> The example would iterate over the sequence of users returned by - "user/list" and define the local variable "u" for each entry. + "user/list" and define the local variable "u" for each entry. Using + the repeat command creates a new variable called "repeat" which you + may access to gather information about the iteration. See the section + below on `the repeat variable`_. **tal:replace="expression"** Replace this tag with the result of the expression. For example:: @@ -1912,6 +1915,34 @@ templates[name].macros[macro_name] +The repeat variable +~~~~~~~~~~~~~~~~~~~ + +The repeat variable holds an entry for each active iteration. That is, if +you have a ``tal:repeat="user db/users"`` command, then there will be a +repeat variable entry called "user". This may be accessed as either:: + + repeat/user + python:repeat['user'] + +The "user" entry has a number of methods available for information: + +=============== ========================================================= +Method Description +=============== ========================================================= +first True if the current item is the first in the sequence. +last True if the current item is the last in the sequence. +even True if the current item is an even item in the sequence. +odd True if the current item is an odd item in the sequence. +number Current position in the sequence, starting from 1. +letter Current position in the sequence as a letter, a through + z, then aa through zz, and so on. +Letter Same as letter(), except uppercase. +roman Current position in the sequence as lowercase roman + numerals. +Roman Same as roman(), except uppercase. +=============== ========================================================= + The utils variable ~~~~~~~~~~~~~~~~~~
