{# Template displays a document corpus catalog, when there is more tham 100 documents. Documents are displayed in groups of 100 documents.#}
{% load static %}

{# select a css style, if a page is displayed in a frame or in a new windows #}
{%  if narrow_doc == "n" %}
    <link rel="stylesheet" href="{% static 'css/document_corpus_narrow.css' %}">
{% else %}
    <link rel="stylesheet" href="{% static 'css/document_corpus.css' %}">
{% endif %}

<div id="corpusFeatures">
    <h2>Features</h2>
    {% for name, value in features.iteritems %}
        <b>{{name}}</b> = {{ value }} <br/><br/>
    {% endfor %}
</div>

<div id="documentList">
    {% for documents in document_catalog %}
        <p class='documentTitle'>
            <a href={% url 'nltk get adc index' widget_id=widget_id document_id_from=documents.first.1|add:"-1" document_id_to=documents.last.1  narrow_doc=narrow_doc %}>
           {{ documents.length}} Documents (from {{ documents.first.1 }} to {{ documents.last.1 }})</a>
        </p>

        <p class='documentText'>
            First <b>{{ documents.first.0.name }}</b>:
            {%  if documents.first.0.text|length > 400 %}
                {{ documents.first.0.text|slice:":400"|add:"..."}}
            {% else %}
                 {{ documents.first.0.text}}
            {% endif %}
        </p>

        <p class='documentText'>
            Last <b>{{ documents.last.0.name }}</b>:
            {%  if documents.last.0.text|length > 400 %}
                {{ documents.last.0.text|slice:":400"|add:"..."}}
            {% else %}
                 {{ documents.last.0.text}}
            {% endif %}
        </p>

        <p class='statistics'>Together contain {{ documents.sum_annotations }}

            {%  if documents.sum_annotations > 1 %}
                annotations
            {% else %}
                annotation
            {% endif %}

            and are described with feature {{ documents.sum_features }}
            {%  if documents.sum_features  > 1 %}
                times.
            {% else %}
                time.
            {% endif %}
        </p>
    {% endfor %}
</div>