{%- set use_linux_64 = 'linux-64' in subdirs -%}
{%- set use_osx_64 = 'osx-64' in subdirs -%}
{%- set use_win_64 = 'win-64' in subdirs -%}
{%- set use_noarch = 'noarch' in subdirs -%}
<html>
<head>
  <title>{{ title }}</title>
  <style type="text/css">
    a, a:active {
      text-decoration: none; color: blue;
    }
    a:visited {
      color: #48468F;
    }
    a:hover, a:focus {
      text-decoration: underline; color: red;
    }
    body {
      background-color: #F5F5F5;
    }
    h2 {
      margin-bottom: 12px;
    }
    th, td {
      font: 100% monospace; text-align: left;
    }
    th {
      font-weight: bold; padding-right: 14px; padding-bottom: 3px;
    }
    th.tight {
        padding-right: 6px;
    }
    td {
      padding-right: 14px;
    }
    td.tight {
        padding-right: 8px;
    }
    td.s, th.s {
      text-align: right;
    }
    td.summary {
      white-space: nowrap;
      overflow: hidden;
    }
    td.packagename {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      max-width: 180px;
      padding-right: 8px;
    }
    td.version {
      //white-space: nowrap;
      overflow: hidden;
      max-width: 90px;
      padding-right: 8px;
    }
    table {
      background-color: white;
      border-top: 1px solid #646464;
      border-bottom: 1px solid #646464;
      padding-top: 10px;
      padding-bottom: 14px;
    }
    address {
      color: #787878;
      padding-top: 10px;
    }
  </style>
</head>
<body>
  <h2>{{ title }}</h2>
  <h3><a href="rss.xml">RSS Feed</a>&nbsp;&nbsp;&nbsp;<a href="channeldata.json">channeldata.json</a></h3>
  {% for subdir in subdirs %}<a href="{{ subdir }}">{{ subdir }}</a>&nbsp;&nbsp;&nbsp;{% endfor %}
  <table>
    <tr>
      <th style="padding-right:18px;">Package</th>
      <th>Latest Version</th>
      <th>Doc</th>
      <th>Dev</th>
      <th>License</th>
      {% if use_linux_64 %}<th class="tight">linux-64</th>{% endif %}
      {% if use_osx_64 %}<th class="tight">osx-64</th>{% endif %}
      {% if use_win_64 %}<th class="tight">win-64</th>{% endif %}
      {% if use_noarch %}<th class="tight">noarch</th>{% endif %}
      <th>Summary</th>
    </tr>
{% for name, record in packages|dictsort %}
    <tr>
      <td class="packagename">{{ name | add_href(record.home) }}</td>
      <td class="version">{{ record.version | truncate(14, True, '') }}</td>
      <td>{% if record.doc_url %}<a href="{{ record.doc_url }}">doc</a>{% endif %}</td>
      <td>{% if record.dev_url %}<a href="{{ record.dev_url }}">dev</a>{% endif %}</td>
      <td class="tight">{% if record.license %}{{ record.license.split(' ')[0] | truncate(15, True, '')  }}{% endif %}</td>
      {% if use_linux_64 %}<td>{% if 'linux-64' in record.subdirs %}X{% endif %}</td>{% endif %}
      {% if use_osx_64 %}<td>{% if 'osx-64' in record.subdirs %}X{% endif %}</td>{% endif %}
      {% if use_win_64 %}<td>{% if 'win-64' in record.subdirs %}X{% endif %}</td>{% endif %}
      {% if use_noarch %}<td>{% if 'noarch' in record.subdirs %}X{% endif %}</td>{% endif %}
      <td class="summary">{{ record.summary | escape | truncate(75) }}</td>
    </tr>
{%- endfor %}
  </table>
  <address>Updated: {{ current_time|strftime("%Y-%m-%d %H:%M:%S %z") }} - Files: {{ packages|length }}</address>
</body>
</html>
