{% macro table(width_or_headers, height_or_rows, striped=false, bordered=false, caption=null) %} {% if width_or_headers is iterable %} {% set headers = width_or_headers %} {% set width = headers | length %} {% else %} {% set headers = [] %} {% set width = width_or_headers %} {% endif %} {% if height_or_rows is iterable %} {% set rows = height_or_rows %} {% set height = rows | length %} {% else %} {% set rows = [] %} {% set height = height_or_rows %} {% endif %}
{% if caption %} {% endif %} {% for idx in range(width) %} {% if headers %} {% else %} {{ caller(0, idx, "head_cell") }} {% endif %} {% endfor %} {% for row_idx in range(height) %} {% for cell_idx in range(width) %} {% if rows %} {% else %} {{ caller(row_idx, cell_idx, "body_cell") }} {% endif %} {% endfor %} {% endfor %}
{{ caption }}
{{ headers[idx] }}
{{ rows[row_idx][cell_idx] }}
{% endmacro %}