{% extends "base.html" %}

{% block content %}

<div class="article-page">

  <div class="article">
    <div class="article__header">
      <div class="article__title">{{ article.title }}</div>

      <div class="article__meta">
        <div class="article-meta">

          <div class="article-meta__item">
            <span class="article-meta__value" title="{{ article.date.isoformat() }}">
              {{ article.date.strftime('%B %d, %Y') }}
            </span>
          </div>

          {% if article.authors or article.author %}
          <span class="article-meta__separator">•</span>
          <div class="article-meta__item">
            <span class="article-meta__value">
              {% if article.authors %}
                {% for author in article.authors %}
                  {% set author_name = AUTHOR_NAMES.get(author|string|trim, author|string|trim) %}
                  {% set author_url = AUTHOR_URLS.get(author|string|trim) %}
                  {% if author_url %}<a href="{{ author_url }}">{{ author_name }}</a>{% else %}{{ author_name }}{% endif %}{% if not loop.last %}{% if loop.revindex == 2 %}{% if loop.length > 2 %}, and {% else %} and {% endif %}{% else %}, {% endif %}{% endif %}
                {% endfor %}
              {% else %}
                {% set author_name = AUTHOR_NAMES.get(article.author, article.author) %}
                {% set author_url = AUTHOR_URLS.get(article.author) %}
                {% if author_url %}
                <a href="{{ author_url }}">{{ author_name }}</a>
                {% else %}
                {{ author_name }}
                {% endif %}
              {% endif %}
            </span>
          </div>
          {% endif %}
        </div>
      </div>
    </div>

    <div class="article-content">
      {{ article.content }}
    </div>
  </div>

</div>

{% endblock %}
