{% load tz %}

<h2>Published in {{ year|date:"Y" }}</h2>

<ul>
{% comment %}
NOTE: Since the context for this template includes a list of UTC datetimes,
I'm turrning off the converstion to "current timezone". This resolves a bug
that happens when:

    - An Entry is published on Feb 1, 2013 at midnight UTC
    - The output date gets changed for someone in another timezone; e.g.
      it'll be Jan 31, 2013 for someone in -600 (me).
    - This results in an url of <a href="/2013/01/">January</a>

{% endcomment %}
{% localtime off %}
{% for d in date_list %}
    <li>
        <a href="{% url 'blargg:entry_archive_month' d|date:"Y" d|date:"m" %}">
        {{ d|date:"F"}}
        </a>
    </li>
{% endfor %}
{% endlocaltime %}
</ul>

<h2>Stats for {{ year|date:"Y" }}</h2>
<p>Total Words written: {{ total_words }}</p>
<table>
  <caption>Most Common words</caption>
  <thead>
    <tr><th>Word</th><th>Times Used</th></tr>
  </thead>
  <tbody>
    {% for word, count in most_common %}
      <tr><td>{{ word }}</td><td>{{ count }}</td></tr>
    {% endfor %}
  </tbody>
</table>

{% if previous_year or next_year %}
    <p>
    {% if previous_year %}
        {% with y=previous_year|date:"Y" %}
        <a href="{% url 'blargg:entry_archive_year' y %}">{{ previous_year|date:"Y" }}</a>.
        {% endwith %}
        |
    {% endif %}

    {{ year|date:"Y" }}.

    {% if next_year %}
        {% with y=next_year|date:"Y" %}
        <a href="{% url 'blargg:entry_archive_year' y %}">{{ next_year|date:"Y" }}</a>.
        {% endwith %}
    {% endif %}
    </p>
{% endif %}
