{% for c in root['children'] %}
    {% set comment = c['comment'] %}
    {% set children = c['children'] %}

    <li class="hentry" id="comment-{{ comment.id }}">

        <p class="entry-title vcard">
            {% set comment_profile_link =  profile_link(comment.user, True) %}
            {% trans %}
                <cite class="author fn">{{comment_profile_link}}</cite> said,
            {% endtrans %}
        </p>
    
        <p class="entry-meta">
            {% set comment_id = comment.id | e %}
            {% set display_name = comment.user.username | e %}
            {% set comment_isotime = comment.date_submitted | isotime | e %}
            {% set comment_timesince = comment.date_submitted | timesince | e %}
            {% trans %}
                Posted <a href="#comment-{{comment_id}}" rel="bookmark" title="Permanent link to this comment by {{display_name}}"><time class="published" pubdate="pubdate" datetime="{{comment_isotime}}" title="{{comment_isotime}}">{{comment_timesince}}</time></a>
            {% endtrans %}
        </p>

        <blockquote class="entry-content">
            {{ comment.comment | nl2br }}
        </blockquote>
        
        {% if request.user.is_authenticated() %}
            <ul class="comment-opts">
              {% if comment.depth < 4 %}
                  <li class="opt-reply"><a href="#comment-post" title="{{_('Reply to this comment by {full_name}') | f(full_name=comment.user.username) }}">{{_('Reply')}}</a></li>
              {% endif %}
              {% if false %}{# TODO: Implement flagging comments #}
                  <li class="opt-report"><a href="/report/confirm" title="{{_('Report this comment')}}">{{_('Report')}}</a></li><!-- Do you have to be logged in to report a comment? -->
              {% endif %}
              {% if false %}{# TODO: Implement editing comments #}
                  <li class="opt-delete"><a href="#" title="{{_('Edit this comment')}}">{{_('Edit')}}</a></li><!-- shown only to demo owner and admins... can users edit their own comments? -->
              {% endif %}
              {% if can_delete_comment(comment, request.user) %}
              <li class="opt-delete"><a class="modal" href="{{ url('demos_delete_comment', object.slug, comment.id) }}" title="{{_('Delete this comment')}}">{{_('Delete')}}</a></li>
              {% endif %}
            </ul>

            {% if comment.depth < 4 %}
            <div class="comment-reply">
                <form method="POST" class="comment_form" action="{{ url('demos_new_reply', slug=object.slug, parent_id=comment.id) }}">
                    {{ csrf() }}
                    <fieldset>
                        <div><textarea name="comment" rows="6" cols="60"></textarea></div>
                        <p><button type="submit">{{_('Comment')}}</button></p>
                    </fieldset>
                </form>
            </div>
            {% endif %}
        {% endif %}

        {% if children | length %}
            <ol class="replies">
                {{ comments_tree(request, object, c) }}
            </ol>
        {% endif %}

    </li>

{% endfor %}
