{% extends "documentation_layout.html" %}

{% block sidebar_content %}
{% if !types.is_empty() %}
<h2>Types</h2>
<ul>
  {% for typ in types %}
  <li><a href="#{{ typ.name }}">{{ typ.name }}</a></li>
  {% endfor %}
</ul>
{% endif %}

{% if !constants.is_empty() %}
<h2>Constants</h2>
<ul>
  {% for constant in constants %}
  <li><a href="#{{ constant.name }}">{{ constant.name }}</a></li>
  {% endfor %}
</ul>
{% endif %}

{% if !functions.is_empty() %}
<h2>Functions</h2>
<ul>
  {% for function in functions %}
  <li><a href="#{{ function.name }}">{{ function.name }}</a></li>
  {% endfor %}
</ul>
{% endif %}
{% endblock %}

{% block content %}
<h1 id="module-name" class="module-name">
  <a href="#module-name">{{ module_name }}</a>
  <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
</h1>
{{ documentation|safe }}

{% if !types.is_empty() %}
<section class="module-members">
  <h1 id="module-types" class="module-member-kind">
    <a href="#module-types">Types</a>
    <svg class="icon icon-gleam-chasse-2"><use xlink:href="#icon-gleam-chasse-2"></use></svg>
  </h1>

  {% for typ in types %}
  <div class="member">
    <div class="member-name">
      <h2 id="{{ typ.name }}">
        <a href="#{{ typ.name }}">
          {{ typ.name }}
        </a>
      </h2>{% if typ.opaque %} <span class="visibility-tag">opaque</span> {% endif %}
      {% if !typ.source_url.is_empty() %}
      <a class="member-source" alt="View Source" title="View Source" href="{{ typ.source_url|safe }}">
        &lt;/&gt;
      </a>
      {% endif %}
    </div>
    {% if !typ.deprecation_message.is_empty() %}
    <p>
      <b>Deprecated:</b> {{ typ.deprecation_message }}
    </p>
    {% endif %}
    <div class="custom-type-constructors">
      <div class="rendered-markdown">{{ typ.documentation|safe }}</div>
      <pre><code class="hljs gleam">{{ typ.definition }}</code></pre>
      {% if !typ.constructors.is_empty() %}
      <h3>
        Constructors
      </h3>
      <ul class="constructor-list">
        {% for constructor in typ.constructors %}
        <li class="constructor-item">
          <div class="constructor-row">
            <svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg>
            <pre class="constructor-name"><code class="hljs gleam">{{ constructor.definition }}</code></pre>
          </div>

          <div class="constructor-item-docs">
            {{ constructor.documentation|safe }}

            {% if !constructor.arguments.is_empty() %}
            <h4>
              Arguments
            </h4>

            <ul class="constructor-argument-list">
            {% for argument in constructor.arguments %}
              <li>
                <div class="constructor-argument-item">
                  <p class="constructor-argument-label">
                    <i>{{ argument.name }}</i>
                  </p>
                  <div class="constructor-argument-doc">
                    {{ argument.doc|safe }}
                  </div>
                </div>
              </li>
            {% endfor %}
            </ul>
            {% endif %}
          </div>
        </li>
        {% endfor %}
      </ul>
      {% endif %}
    </div>
  </div>
  {% endfor %}
</section>
{% endif %}

{% if !constants.is_empty() %}
<section class="module-members">
  <h1 id="module-constants" class="module-member-kind">
    <a href="#module-constants">Constants</a>
    <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
  </h1>

  {% for constant in constants %}
  <div class="member">
    <div class="member-name">
      <h2 id="{{ constant.name }}">
        <a href="#{{ constant.name }}">
          {{ constant.name }}
        </a>
      </h2>
      {% if !constant.source_url.is_empty() %}
      <a class="member-source" alt="View Source" title="View Source" href="{{ constant.source_url|safe }}">
        &lt;/&gt;
      </a>
      {% endif %}
    </div>
    <pre><code class="hljs gleam">{{ constant.definition }}</code></pre>
    <div class="rendered-markdown">{{ constant.documentation|safe }}</div>
  </div>
  {% endfor %}
</section>
{% endif %}

{% if !functions.is_empty() %}
<section class="module-members">
  <h1 id="module-functions" class="module-member-kind">
    <a href="#module-functions">Functions</a>
    <svg class="icon icon-gleam-chasse"><use xlink:href="#icon-gleam-chasse"></use></svg>
  </h1>
  {% for function in functions %}
  <div class="member">
    <div class="member-name">
      <h2 id="{{ function.name }}">
        <a href="#{{ function.name }}">
          {{ function.name }}
        </a>
      </h2>
      {% if !function.source_url.is_empty() %}
      <a class="member-source" alt="View Source" title="View Source" href="{{ function.source_url|safe }}">
        &lt;/&gt;
      </a>
      {% endif %}
    </div>

    <pre><code class="hljs gleam">{{ function.signature }}</code></pre>
    {% if !function.deprecation_message.is_empty() %}
    <p>
      <b>Deprecated:</b> {{ function.deprecation_message }}
    </p>
    {% endif %}
    <div class="rendered-markdown">{{ function.documentation|safe }}</div>
  </div>
  {% endfor %}
</section>
{% endif %}
{% endblock %}
