{% load markdown %}
{% load i18n %}
{% load vulns %}

<article id="vulnerability-listing" class="chapter">
    <h1 class="chapter-title" id="vulnerability-listing-title">{% trans 'Technical Details' %}</h1>
</article>

<section>
    <p>
        {% blocktrans %}
        This section contains a list of all vulnerabilities found and how to reproduce them.
        Impact and criticality information is provided for each vulnerability.
        Recommendations for remediation are also included.
        {% endblocktrans %}
    </p>
</section>

{% for template in templates %}
<section id="template-{{ template.pk }}">
    <h2>{{ template.name }}</h2>
    <section>
        <h4>Description</h4>
        <p>{{ template.description|md_to_html }}</p>
    </section>
    <section>
        <h4>Recommendation</h4>
        <p>{{ template.recommendation|md_to_html }}</p>
    </section>
    {% if template.reference_set.count %}
    <section>
        <h4>References</h4>
        <ul>
            {% for ref in template.reference_set.all %}
                <li><a href="{{ ref.name }}">{{ ref.name }}</a></li>
            {% endfor %}
        </ul>
    {% endif %}

    <div class="page-break"></div>

    <section id="template-{{ template.pk}}-vulnerbilities">
    {% for vulnerability in template|get_vulns_for_project:project %}
        {% include './single_vulnerability.html' %}
    {% endfor %}
    </section>
    {% if not forloop.last %}
    <div class="page-break"></div>
    {% endif %}
</section>
{% endfor %}
