{% macro render_thumbnail(parent, thumbnail_size=None, no_external_references=False) -%} {% set thumb = parent.thumbnail(thumbnail_size) %} {% if not no_external_references and thumb %} {% else %} {% endif %} {%- endmacro %} {% macro render_message(message, preview_size=None, no_external_references=False) -%}
{% if not no_external_references %} {% if message.img %}{%else%}
{%endif%} {% 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 not no_external_references %} {% endif %}} {%if attachment.author_link%}{%endif%} {{attachment.author_name}} {%if attachment.author_link%}({{attachment.author_link}}){%endif%}
{%endif%} {% if not no_external_references %} {%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%} {%endif%}
{% endfor %} {% for file in message.files -%}
{% if not no_external_references %} {{ render_thumbnail(file, preview_size) }} {%endif%}
{% endfor %} {% for reaction in message.reactions %}
{{ reaction.name }} {{ reaction.usernames|join(', ') }}
{% endfor %}
{%- endmacro %}