{% load filters functions i18n %}
<li data-id="{{ entry.pk }}" {% print_entry_class %}{% if show_title == "yes" %} data-topic="{{ entry.topic.title }}"{% endif %}>
    <section>
    {% with time=entry.date_created|entrydate:entry.date_edited %}
        <header class="entry-individual">
            {% if show_title == "yes" %}
                <h2><a href="{{ entry.topic.get_absolute_url }}">{{ entry.topic.title }}</a></h2>
            {% endif %}

            <div class="mobile">
                {% if not entry.author.is_private %}
                    <div><a class="username fs-16 fw-600" href="{{ entry.author.get_absolute_url }}">{{ entry.author.username }}</a></div>
                {% else %}
                    <span class="username"><i>{% trans "anonymous" %}</i></span>
                {% endif %}

                <a role="button" title="{% trans "entry actions" %}" tabindex="0" class="action" data-toggle="dropdown" aria-haspopup="true">
                    <svg width="25" height="13" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                        <use href="#more"></use>
                    </svg>
                </a>

                <a href="{{ entry.get_absolute_url }}" class="permalink">
                    <time datetime="{{ entry.date_created|date:"c" }}">{{ time }}</time>
                </a>
                <div class="dropdown-menu entry-actions icon-assisted"></div>
            </div>
        </header>

        <article class="entry{% if entry.author.is_novice %} by_novice{% endif %}{% if permalink == "yes" %} permalink{% endif %}">
            {% if wordstomark %}
                <p>{{ entry.content|formatted|mark:wordstomark|linebreaksbr }}</p>
            {% else %}
                <p>{{ entry.content|formatted|linebreaksbr }}</p>
            {% endif %}
        </article>

        <footer class="entry-footer">
            <div class="feedback">
                <div class="social">
                    <a role="button" tabindex="0" title="{% trans "share to facebook" %}" class="facebook">
                        <svg width="25" height="13" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                            <use href="#facebook"></use>
                        </svg>
                    </a>
                    <a role="button" tabindex="0" title="{% trans "tweet this in twitter" %}" class="twitter">
                        <svg width="25" height="13" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                            <use href="#twitter"></use>
                        </svg>
                    </a>
                </div>

                {% if user != entry.author %}
                    <div class="votes entry-vote">
                        <a role="button" tabindex="0" title="{% trans "nice!" %}" class="vote upvote{{ entry.is_upvoted|yesno:" active," }}">
                            <svg width="25" height="13" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                                <use href="#up"></use>
                            </svg>
                        </a>

                        <a role="button" tabindex="0" title="{% trans "awful" %}" class="vote downvote{{ entry.is_downvoted|yesno:" active," }}">
                            <svg width="25" height="13" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                                <use href="#down"></use>
                            </svg>
                        </a>
                    </div>
                {% endif %}

                {% if user.is_authenticated %}
                    <div class="favorites">
                        <a role="button" tabindex="0" {% if entry.is_favorited %}title="{% trans "remove from favorites" %}" class="favorite active" {% else %}title="{% trans "add to favorites"  %}" class="favorite"{% endif %}>
                            <svg width="25" height="13" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
                                <use href="#favorite"></use>
                            </svg>
                        </a>
                        {% with entry.favorited_by.count as fav_count %}
                            <a role="button" class="fav-count" tabindex="{{ fav_count|yesno:"0,-1" }}" data-toggle="dropdown" aria-label="{% trans "Favorites" %}" aria-haspopup="true" aria-expanded="false" {% if not fav_count %}aria-hidden="true" {% endif %}>{% firstof fav_count %}</a>
                            <span class="dropdown-menu no-collapse favorites-list tinybar" data-orientation="bottom-start" data-loaded="false"></span>
                        {% endwith %}
                    </div>
                {% endif %}
            </div>

            <div class="meta">
                <a href="{{ entry.get_absolute_url }}" class="permalink">
                    <time datetime="{{ entry.date_created|date:"c" }}">{{ time }}</time>
                </a>
                {% if not entry.author.is_private %}
                    <a class="username" href="{{ entry.author.get_absolute_url }}">{{ entry.author.username }}</a>
                {% else %}
                    <span class="username"><i>{% trans "anonymous" %}</i></span>
                {% endif %}

                <a role="button" tabindex="0" title="{% trans "entry actions" %}" class="action" data-toggle="dropdown" aria-haspopup="true">
                    <svg width="25" height="13" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                        <use href="#more"></use>
                    </svg>
                </a>
                <div class="dropdown-menu entry-actions icon-assisted"></div>
            </div>
        </footer>
    {% endwith %}
    </section>

{% with comments=entry.comments.all %}
    {% if show_comments and comments %}
        <section class="ama-comments">
            {% for comment in comments %}
                <div class="comment d-flex align-items-center" id="comment-{{ comment.pk }}">
                    <aside class="votes comment-vote d-flex flex-column align-items-center px-3" data-id="{{ comment.pk }}">
                        <a class="vote upvote{{ comment.is_upvoted|yesno:" active," }}" role="button" tabindex="0" title="{% trans "nice!" %}">
                            <svg width="25" height="16" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                                <use href="#up"></use>
                            </svg>
                        </a>
                        <strong class="rating">{{ comment.rating }}</strong>
                        <a class="vote downvote{{ comment.is_downvoted|yesno:" active," }}" role="button" tabindex="0" title="{% trans "awful" %}">
                            <svg width="25" height="16" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
                                <use href="#down"></use>
                            </svg>
                        </a>
                    </aside>
                    <article class="w-100">
                        <p class="text-formatted">{{ comment.content|formatted|linebreaksbr }}</p>
                        <footer class="d-flex justify-content-between fs-90">
                            {% firstof comment.author.get_full_name|i18n_lower comment.author.username as name %}
                            <span>{% blocktrans with name_url=comment.author.get_absolute_url %}replied by <a href="{{ name_url }}">{{ name }}</a>.{% endblocktrans %}</span>
                            <div>
                                {% if user == comment.author %}
                                    <a class="mr-2" href="{% url 'comment_update' pk=comment.pk %}">{% trans "edit" %}</a>
                                {% endif %}
                                <a href="{{ comment.get_absolute_url }}">
                                    <time datetime="{{ comment.date_created|date:"c" }}">{{ comment.date_created|entrydate:comment.date_edited }}</time>
                                </a>
                            </div>
                        </footer>
                    </article>
                </div>
            {% endfor %}
        </section>
    {% endif %}
{% endwith %}
</li>
