Skip to content

Commit 2befaac

Browse files
committed
doc: fix repeat section first -> start, last -> end
The repeat documentation for TAL states there are first and last methods. They do exist, but don't work as documented. Replace with first and last methods that match current TAL and PHPTal method documentation. Also create a simple example of using end.
1 parent 5a2ba78 commit 2befaac

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

doc/reference.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,8 +3516,8 @@ The "user" entry has a number of methods available for information:
35163516
=============== =========================================================
35173517
Method Description
35183518
=============== =========================================================
3519-
first True if the current item is the first in the sequence.
3520-
last True if the current item is the last in the sequence.
3519+
start True if the current item is the first in the sequence.
3520+
end True if the current item is the last in the sequence.
35213521
even True if the current item is an even item in the sequence.
35223522
odd True if the current item is an odd item in the sequence.
35233523
number Current position in the sequence, starting from 1.
@@ -3529,6 +3529,18 @@ roman Current position in the sequence as lowercase roman
35293529
Roman Same as roman(), except uppercase.
35303530
=============== =========================================================
35313531

3532+
For example, this will print a comma after each element except the
3533+
last::
3534+
3535+
<span>
3536+
<tal:x tal:repeat="field
3537+
python:request.form['properties'].value.split(',')">
3538+
<tal:x tal:replace="field"></tal:x>
3539+
<tal:x tal:condition="python:not repeat['field'].end"
3540+
tal:content="string:,"></tal:x>
3541+
</tal:x>
3542+
</span>
3543+
35323544
.. _templating utilities:
35333545

35343546
The utils variable

0 commit comments

Comments
 (0)