{# Reusable table macro: render a list of records (dicts) as an HTML table. Keys of the first record become the column headings; numeric cells are right- aligned. Used for every tabular section of the report, so one definition serves both the contents list and the revisions data. #} {% macro render_table(rows, caption=None) -%} {% if rows %}
{% if caption %}{% endif %} {% for key in rows[0].keys() %}{% endfor %} {% for row in rows %} {% for value in row.values() %} {{ value if value is not none else "" }} {% endfor %} {% endfor %}
{{ caption }}
{{ key }}
{% else %}

No data.

{% endif %} {%- endmacro %}