{#
    This file is part of quark-sphinx-theme.
    Copyright (c) 2016 Felix Krull <f_krull@gmx.de>
    Released under the terms of the BSD license; see LICENSE.
#}

{% extends 'basic/layout.html' %}

{%- set css_files = theme_extra_css_files.split(',') -%}

{% macro navbar() %}
  <tr>
    {# hierarchical navigation -#}
    <td width="50%">
      <a class="nav-item nav-item-0" 
         href="{{ pathto(master_doc) }}">{{ shorttitle | e }}</a>
        {%- if parents %}{{ reldelim1 }} {% endif %}
        {%- for parent in parents -%}
          <a class="nav-item nav-item-{{ loop.index }}"
             href="{{ parent.link | e }}">{{ parent.title }}</a>
          {% if not loop.last %}{{ reldelim1 }} {% endif %}
        {%- endfor %}
    </td>

    {# right-hand misc links; prev, next, indices -#}
    <td align="right" width="50%">
      {% for rellink in rellinks | reverse -%}
        <a class="rel-item rel-item-{{ loop.index }}"
           href="{{ pathto(rellink[0]) }}"
           title="{{ rellink[1] | striptags | e }}"
           {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
        {% if not loop.last %}{{ reldelim2 }} {% endif %}
      {% endfor %}
    </td>

  </tr>
{% endmacro %}

{% macro sidebar_table() %}
  {%- if render_sidebar -%}
    <table class="nav-sidebar">
      <tr>
        <td width="20%" class="nav-sidebar-td">
          {{ sidebar() }}
        </td>
      </tr>
    </table>
  {%- endif -%}
{% endmacro %}

{% block relbar1 %}
  <table class="navbar navbar-top">
    {{ navbar() }}
  </table>
{% endblock %}

{% block sidebar1 %}{{ sidebar_table() }}{% endblock %}
{% block sidebar2 %}{% endblock %}

{% block relbar2 %}{% endblock %}

{% block footer %}
  <table class="navbar navbar-bottom">
    {{ navbar() }}
    <tr>
      <td colspan="2" align="center">
        {{ super() }}
      </td>
    </tr>
  </table>
{% endblock %}
