{% extends "base.html" %}

{% block title %}{{ namespace.name }} &ndash; {{ namespace.version }}: {{ content.title }}{% endblock %}

{% block meta_other %}
  <meta property="og:title" content="{{ namespace.name }}: {{ content.title }}"/>
  <meta property="og:description" content="Reference for {{ namespace.name }}-{{ namespace.version }}: {{ content.title }}"/>
  <meta name="twitter:title" content="{{ namespace.name }}: {{ content.title }}"/>
  <meta name="twitter:description" content="Reference for {{ namespace.name }}-{{ namespace.version }}: {{ content.title }}"/>
{% endblock %}

{% block content %}
<section id="main" class="content">
  {% if content.title %}
  <h4 id="title" style="display:flex;">
    {{ content.title }}
    <a href="#title" class="anchor"></a>
    {% if CONFIG.content_base_url %}
    <a class="srclink" title="go to source location" href="{{ CONFIG.content_link(content.source_file) }}">[src]</a>
    {% endif %}
  </h4>
  {% endif %}
  <section>
    <div class="docblock">
    {{ content.data }}
    </div>
  </section>
</section>
{% endblock %}

{% if content.toc|length > 0 %}
{% block navbar %}
<div id="toc" class="toc">
  <nav aria-labelledby="toc-title">
    <p id="toc-title">Content</p>
    <ul class="toc-list">
      {% if content.toc|length == 1 %}
        {% for subheader in content.toc[0].children %}
        <li class="toc-list-item"><a href="#{{ subheader.id }}"><span class="link-text">{{ subheader.name }}</span></a></li>
        {% endfor %}
      {% else %}
        {% for header in content.toc %}
        <li class="toc-list-item"><a href="#{{ header.id }}"><span class="link-text">{{ header.name }}</span></a></li>
          {% if header.children %}
          <ul class="toc-list">
          {% for subheader in header.children %}
            <li class="toc-list-item"><a href="#{{ subheader.id }}"><span class="link-text">{{ subheader.name }}</span></a></li>
          {% endfor %}
          </ul>
          {% endif %}
        {% endfor %}
      {% endif %}
    </ul>
  </nav>
</div>
{% endblock %}
{% endif %}
