{# This is the body of a post. Expects "post", "to_root" argument. #}

<DIV class="postbody" id="postbody">
    {% block postbody %}
        {% if post.post_hint == "image" %}
            <img class="postimage" src="{{ post.url|rewrite_url(to_root) }}"></image>
        {% elif post.is_gallery and (post.media_metadata not in ("null", "false"))%}
            {% with gallery_data=post.media_metadata|load_json, to_root=to_root %}
                {% include "gallery.html.jinja" %}
            {% endwith %}
        {% elif post.is_poll%}
            {% with poll_data=post.poll_data|load_json, post=post, to_root=to_root %}
                {% include "poll.html.jinja" %}
            {% endwith %}
        {% elif (post.post_hint in ("rich:video", "hosted:video")) %}
            {% if options.with_videos %}
                <video autoplay=1 controls=1 loop=1 src="{{ post.url|rewrite_url(to_root) }}">Video</video>
            {% else %}
                <P class="arcticzim-message">[Video not included]</P>
            {% endif %}
        {% elif post.is_crosspost and (post.url is local_post_url) %}
            <DIV class="crosspost-container">
                {{ post.url|render_postsummary_by_url(to_root) }}
            </DIV>
        {% endif %}
        <DIV class="postbodytext mdbody"> {{ post.selftext|render_post_text(to_root=to_root) }}</DIV>
    {% endblock %}
</DIV>
