{% macro message(m, index, urlpath)-%}
{% set path = urlpath + '/' + index|string %}
{{ index }}. {{ m.subject }} {{ m.author_name }}
{% if m.get('follow-up') %}
{% for msg in m.get('follow-up') %}
{{ message(m=msg, index=loop.index - 1, urlpath=path) }}
{% endfor %}
{% endif %}
{%- endmacro %}
{% for m in threads recursive %}
{{ message(m=m, index=loop.index - 1, urlpath=sublist_name) }}
{% endfor %}