{% macro header(cols, next=None, prev=None, shown=0, total=0, item_name='Items', selectable=True) %} {% if selectable %} {% set width = 95 %} {% else %} {% set width = 100 %} {% endif %} {% for col in cols %} {{ col }} {% endfor %} {% set col_len = cols|length %} {{ item_name }} {{ shown }} of {{ total }}  
{% if prev %} Prev {% else %} Prev {% endif %} {% if next %} Next {% else %} Next {% endif %}
{% endmacro %} {% macro body(cols, items, selectable=True) %} {% for item in items %} {% if selectable %} {% endif %} {% for col in cols %} {{ item[col] }} {% endfor %} {% endfor %} {% endmacro %} {% macro table(cols, items, caption=None, next=None, prev=None, shown=0, total=0, item_name='Items', selectable=True) %} {% if caption %} {% endif %} {{ header(cols, next, prev, shown, total, item_name, selectable) }} {{ body(cols, items, selectable) }}
{{ caption }}
{% endmacro %} {{ table(cols, items, caption, next, prev, shown, total, item_name, selectable) }}