{% load djeuscan_helpers %}
{% load url from future %}

<dl>
  {% if package.description %}
  <dt>Description</dt>
  <dd>{{ package.description }}</dd>
  {% endif %}
  {% if package.homepage %}
  <dt>Homepage</dt>
  <dd>
    {% for homepage in package.homepages %}
    <a href="{{ homepage }}">{{ homepage }}</a><br />
    {% endfor %}
  </dd>
  {% endif %}
  {% if package.herds.all %}
  <dt>Herds</dt>
  <dd>
    {% for herd in package.herds.all %}
      <p>
        <a href="{% url "herd" herd.herd %}">
          {{ herd.herd }}
        </a>
        &lt;{{ herd.email }}&gt;
      </p>
    {% endfor %}
  </dd>
  {% endif %}
  {% if package.maintainers.all %}
  <dt>Maintainers</dt>
  <dd>
    {% for maintainer in package.maintainers.all %}
      <p>
        {% if maintainer.name != maintainer.email %}
         <a href="{% url "maintainer" maintainer.email %}">
           {{ maintainer.name }}
         </a>
         &lt;{{ maintainer.email }}&gt;
        {% else %}
         <a href="{% url "maintainer" maintainer.email %}">
         {{ maintainer.email }}
         </a>
        {% endif %}
      </p>
    {% endfor %}
  </dd>
  {% endif %}
  {% if packaged %}
  <dt>Packaged Versions</dt>
  <dd>
    <ul>
      {% for version in packaged %}
      <li id="version-{{ version.tag }}">
        {% if version.overlay == "gentoo" %}
          <img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="In Gentoo" />
        {% else %}
          <img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="In Overlays" />
        {% endif %}

        {% if version.vtype and not version.vtype|is_stable %}
          <img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
        {% endif %}

        {% if version.ebuild_path %}
          <a href="{% url "package_version_ebuild" package.category package.name version.tag %}">
            {{ version.version }}{% if version.revision != "r0" %}-{{ version.revision }}{% endif %}{% if version.slot != "0" %}:{{ version.slot }}{% endif %}
          </a>
        {% endif %}
        {% if version.metadata_path %}
        <a href="{% url "package_version_metadata" package.category package.name version.tag %}">
          <img src="{{ STATIC_URL }}img/metadata.png" alt="Metadata" />
        </a>
        {% endif %}
      </li>
      {% endfor %}
    </ul>
  </dd>
  {% endif %}
  {% if upstream %}
  <dt>Upstream versions</dt>
  <dd>
    <ul>
      {% for version in upstream %}
      <li id="version-{{ version.tag }}">
        <img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />

        {% if version.vtype and not version.vtype|is_stable %}
          <img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
        {% endif %}

        {{ version.version }} -
        {% for url in version.urls_list %}
          <a href="{{ url }}">{{ url }}</a>
        {% endfor %}
        {% if confidence < 100 %}({{ version.confidence }}%){% endif %}
      </li>
      {% endfor %}
     </ul>
  </dd>
  {% endif %}
  {% include "euscan/_package_vlogs.html" %}
  {% if log %}
  <dt>euscan log</dt>
  <dd>
    <p>Date: {{ log.datetime }}</p>
    <pre class="log">{{ msg|ansi_to_html|safe }}</pre>
  </dd>
  {% endif %}
</dl>
