You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
31 lines
1.0 KiB
2 years ago
|
<!--
|
||
|
You can cycle through a list (in this case a cons list) using a
|
||
|
for-loop with djula.
|
||
|
|
||
|
---------------------------------------------------------------
|
||
|
|
||
|
The use of format and ~:D here produces a rendering bug --
|
||
|
single double quote at the start of the number represented by
|
||
|
'val'. This was originally highlighted in step13.html (the view
|
||
|
and controller).
|
||
|
|
||
|
I removed the double quotes from ~:D (which is how the tutorial
|
||
|
presented it. By doing this, the single double-quote problem went
|
||
|
away. To get double-quotes around 'val' now, you will need to wrap
|
||
|
val | format: ~:D in double-quotes (outside the brackets {{ & }}).
|
||
|
The use of ':' in '~:D' adds a comma as a seperator to the number
|
||
|
(stored as 'val'). It displays as '2,680' instead of '2680'.
|
||
|
-->
|
||
|
|
||
|
<p>
|
||
|
<table border="1" cellpadding="4">
|
||
|
{% for (key . val) in items %}
|
||
|
<tr>
|
||
|
<th>{{ key }}</th>
|
||
|
<td style="text-align: right">{{ val | format: ~:D }} Currency Points</td>
|
||
|
</tr>
|
||
|
{% endfor %}
|
||
|
</table>
|
||
|
</p>
|
||
|
|