pub fn batch(
state: &State<'_, '_>,
value: Value,
count: usize,
fill_with: Option<Value>,
) -> Result<Value, Error>
Expand description
Batch items.
This filter works pretty much like slice
just the other way round. It
returns a list of lists with the given number of items. If you provide a
second parameter this is used to fill up missing items.
<table>
{% for row in items|batch(3, ' ') %}
<tr>
{% for column in row %}
<td>{{ column }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>