aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-05 04:00:39 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-05 04:00:39 +0000
commitb71033f59ed3ed06e803312a839b52374501e88f (patch)
tree0266f17a173a79953e6234bd327c38ad0feae9e3 /examples
parent1328cee1572c2d47d8d315590aa0478d56176dd5 (diff)
downloadexternal_python_mako-b71033f59ed3ed06e803312a839b52374501e88f.tar.gz
external_python_mako-b71033f59ed3ed06e803312a839b52374501e88f.tar.bz2
external_python_mako-b71033f59ed3ed06e803312a839b52374501e88f.zip
added the "check for last" step back to the tests - illustrates how the different systems handle such a step
Diffstat (limited to 'examples')
-rw-r--r--examples/bench/cheetah/template.tmpl2
-rw-r--r--examples/bench/django/templates/template.html2
-rw-r--r--examples/bench/mako/template.html4
-rw-r--r--examples/bench/myghty/template.myt4
4 files changed, 6 insertions, 6 deletions
diff --git a/examples/bench/cheetah/template.tmpl b/examples/bench/cheetah/template.tmpl
index a0b5593..c7cf1e4 100644
--- a/examples/bench/cheetah/template.tmpl
+++ b/examples/bench/cheetah/template.tmpl
@@ -21,7 +21,7 @@
#if $list_items
<ul>
#for $list_item in $list_items
- <li>$list_item</li>
+ <li #if $list_item is $list_items[-1] then "class='last'" else ""#>$list_item</li>
#end for
</ul>
#end if
diff --git a/examples/bench/django/templates/template.html b/examples/bench/django/templates/template.html
index 44363f8..cae6c5e 100644
--- a/examples/bench/django/templates/template.html
+++ b/examples/bench/django/templates/template.html
@@ -14,7 +14,7 @@
{% if items %}
<ul>
{% for item in items %}
- <li>{{ item }}</li>
+ <li{% if forloop.last %} class="last"{% endif %}>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
diff --git a/examples/bench/mako/template.html b/examples/bench/mako/template.html
index 2bd9fce..96ccf79 100644
--- a/examples/bench/mako/template.html
+++ b/examples/bench/mako/template.html
@@ -20,8 +20,8 @@
<h2>Loop</h2>
% if list_items:
<ul>
- % for list_item in list_items:
- <li>${list_item}</li>
+ % for i, list_item in enumerate(list_items):
+ <li ${i+1==len(list_items) and "class='last'" or ""}>${list_item}</li>
% endfor
</ul>
% endif
diff --git a/examples/bench/myghty/template.myt b/examples/bench/myghty/template.myt
index db0cc4b..138e0ae 100644
--- a/examples/bench/myghty/template.myt
+++ b/examples/bench/myghty/template.myt
@@ -21,8 +21,8 @@
<h2>Loop</h2>
%if items:
<ul>
-% for item in items:
- <li><% item %></li>
+% for i, item in enumerate(items):
+ <li <% i+1==len(items) and "class='last'" or ""%>><% item %></li>
%
</ul>
%