[Zope-Checkins] CVS: Releases/Zope/lib/python/Products/PageTemplates/help - tal-repeat.stx:1.4.14.1

Evan Simpson evan@zope.com
Thu, 13 Dec 2001 15:26:04 -0500


Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates/help
In directory cvs.zope.org:/tmp/cvs-serv20474/Products/PageTemplates/help

Modified Files:
      Tag: Zope-2_5-branch
	tal-repeat.stx 
Log Message:
Merge changes from trunk


=== Releases/Zope/lib/python/Products/PageTemplates/help/tal-repeat.stx 1.4 => 1.4.14.1 ===
       o *end* - true for the ending, or final, repetition.
 
+      o *first* - true for the first item in a group - see note below
+
+      o *last* - true for the last item in a group - see note below
+
       o *length* - length of the sequence, which will be the total number
         of repetitions.
 
-      o *letter* - count reps with lower-case letters: "a" - "z", "aa" - "az",
-        "ba" - "bz", ..., "za" - "zz", "aaa" - "aaz", and so forth.
+      o *letter* - repetition number as a lower-case letter: "a" -
+        "z", "aa" - "az", "ba" - "bz", ..., "za" - "zz", "aaa" - "aaz",
+        and so forth.
 
       o *Letter* - upper-case version of *letter*.
 
+      o *roman* - repetition number as a lower-case roman numeral:
+        "i", "ii", "iii", "iv", "v", etc.
+
+      o *Roman* - upper-case version of *roman*.
+
     You can access the contents of the repeat variable using path
     expressions or Python expressions.  In path expressions, you write
     a three-part path consisting of the name 'repeat', the statement
@@ -59,6 +69,15 @@
     attribute access to get the information, for example,
     'python:repeat['item'].start'.
 
+    Note that 'first' and 'last' are intended for use with sorted
+    sequences.  They try to divide the sequence into group of items
+    with the same value.  If you provide a path, then the value
+    obtained by following that path from a sequence item is used for
+    grouping, otherwise the value of the item is used.  You can
+    provide the path by passing it as a parameter, as in
+    "python:repeat['item'].first('color')", or by appending it to the
+    path from the repeat variable, as in "repeat/item/first/color".
+
   Examples
 
     Iterating over a sequence of strings::    
@@ -88,5 +107,14 @@
                               z python:x*y"
                   tal:replace="string:$x * $y = $z">1 * 1 = 1</span>
           </td>
+        </tr>
+      </table>
+
+    Objects (already sorted by meta-type) in groups by meta-type::
+
+      <table border="1">
+        <tr tal:repeat="object objects">
+          <td><span tal:condition="repeat/object/first/meta_type"
+                    tal:replace="object/meta_type">Meta Type</span></td>
         </tr>
       </table>