{# Template displays a document corpus for less tham 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">
    {# if there is more than 100 documents, display a back link #}
    {% if back_url != "" %}
        <a id="backlinkA" href="Index.html"> << Back to document catalog </a>
        <br/>
    {% endif %}

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

<div id="documentList">

    {% for document in documents %}
        <p class='documentTitle'>
            <a href={% url 'nltk get adc page' widget_id=widget_id document_id=document.additions.id narrow_doc=narrow_doc %}>{{ document.name }}</a>
        </p>

        <p class='documentText'>
            {%  if document.text|length > 400 %}
                {{ document.text|slice:":400"|add:"..."}}
            {% else %}
                 {{ document.text}}
            {% endif %}
        </p>

        <p class='statistics'>
            Contains {{ document.annotations|length }}
            {%  if document.annotations|length > 1 %}
                 annotations
            {% else %}
                 annotation
            {% endif %}

            of {{document.additions.basic_types}} basic
            {%  if document.additions.basic_types  > 1%}
                types.
            {% else %}
                type.
            {% endif %}

            Described with  {{document.features|length}}
            {%  if document.features|length > 1 %}
                features.
            {% else %}
                feature.
            {% endif %}
        </p>

    {% endfor %}

</div>

