{% macro render_thumbnail(parent, thumbnail_size=None) -%} {% set thumb = parent.thumbnail(thumbnail_size) %} {% if thumb %} {% else %} {% endif %} {%- endmacro %} {% macro render_message(message, preview_size) -%}
{%if message.img%}{%else%}
{%endif%}
{{ message.username }} {%if message.user.email%} ({{message.user.email}}){%endif%}
{{ message.time }}
{{ message.msg|safe }} {% for attachment in message.attachments -%}
{%if attachment.service_name %}
{{ attachment.service_name }}
{%endif%} {%if attachment.author_name%}
{%if attachment.author_link%}{%endif%} {{attachment.author_name}} {%if attachment.author_link%}({{attachment.author_link}}){%endif%}
{%endif%} {%if attachment.pretext %}
{{attachment.pretext}}
{%endif%} {%for field in attachment.fields %}
{%if field.title %}
{{field.title}}
{%endif%} {{field.value}}
{%endfor%} {{ render_thumbnail(attachment, preview_size) }} {% if attachment.original_url %} {% endif %} {%if attachment.footer%} {%endif%}
{% endfor %} {% for file in message.files -%}
{{ render_thumbnail(file, preview_size) }}
{% endfor %}
{%- endmacro %}