{%- macro branch_table(branches) -%}
    <thead>
    <tr>
        <th>Branch</th>
        <th>Commit message</th>
        <th>Author</th>
        <th>Age</th>
    </tr>
    </thead>

    <tbody>
    {% for (name, commit) in branches -%}
    <tr>
        <td><a href="/{{ repo.display() }}/log/?h={{ name }}">{{ name }}</a></td>
        <td><a href="/{{ repo.display() }}/commit/?id={{ commit.get().hash|hex }}">{{ commit.get().summary }}</a></td>
        <td>
            <img src="{{ commit.get().author.email|gravatar }}" width="13" height="13">
            {{ commit.get().author.name }}
        </td>
        <td>
            <time datetime="{{ commit.get().author.time|format_time }}" title="{{ commit.get().author.time|format_time }}">
                {{- commit.get().author.time|timeago -}}
            </time>
        </td>
    </tr>
    {% endfor -%}
    </tbody>
{%- endmacro -%}

{%- macro tag_table(tags) -%}
    <thead>
    <tr class="no-background">
        <th>Tag</th>
        <th>Download</th>
        <th>Author</th>
        <th>Age</th>
    </tr>
    </thead>

    <tbody>
    {% for (name, tag) in tags -%}
    <tr>
        <td><a href="/{{ repo.display() }}/tag/?h={{ name.get() }}">{{- name.get() -}}</a></td>
        <td><a href="/{{ repo.display() }}/snapshot?h={{ name.get() }}">{{- name.get() -}}.tar.gz</a></td>
        <td>
            {% if let Some(tagger) = tag.get().tagger.as_ref() -%}
            <img src="{{ tagger.email|gravatar }}" width="13" height="13">
            {{ tagger.name }}
            {%- endif %}
        </td>
        <td>
            {% if let Some(tagger) = tag.get().tagger.as_ref() -%}
            <time datetime="{{ tagger.time|format_time }}" title="{{ tagger.time|format_time }}">
                {{- tagger.time|timeago -}}
            </time>
            {%- endif %}
        </td>
    </tr>
    {% endfor -%}
    </tbody>
{%- endmacro -%}

{%- macro commit_table(commits) -%}
    <thead>
    <tr>
        <th>Age</th>
        <th>Commit message</th>
        <th>Author</th>
    </tr>
    </thead>

    <tbody>
    {% for commit in commits -%}
    {% set commit = commit.get() %}
    <tr>
        <td>
            <time datetime="{{ commit.committer.time|format_time }}" title="{{ commit.committer.time|format_time }}">
                {{- commit.committer.time|timeago -}}
            </time>
        </td>
        <td><a href="/{{ repo.display() }}/commit/?id={{ commit.hash|hex }}">{{ commit.summary }}</a></td>
        <td>
            <img src="{{ commit.author.email|gravatar }}?s=13&d=retro" width="13" height="13">
            {{ commit.author.name }}
        </td>
    </tr>
    {% endfor -%}
    </tbody>
{%- endmacro -%}
