{% extends "_layout.html" %}

{% block sidebar_content %}
{% if !types.is_empty() %}
<h2>Types</h2>
<ul>
  {% for type_info in types %}
  <li><a href="#{{ type_info.name }}">{{ type_info.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>
</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>
  </h1>

  {% for type_info in types %}
  <div class="member">
    <div class="member-name">
      <h2 id="{{ type_info.name }}">
        <a href="#{{ type_info.name }}">
	  {{ type_info.name }}{% if !type_info.parameters.is_empty() %}&lt;{{ type_info.parameters.join(", ") }}&gt;{% endif %}
        </a>
      </h2>
      {% if !type_info.source_url.is_empty() %}
      <!-- TODO: support source linking
      <a class="member-source" alt="View Source" title="View Source" href="{{ type_info.source_url|safe }}">
        &lt;/&gt;
      </a>
      -->
      {% endif %}
    </div>
    <div class="custom-type-constructors">
      <div class="rendered-markdown">{{ type_info.documentation|safe }}</div>
      {% if !type_info.constructors.is_empty() %}
      <h3>Constructors</h3>
      <ul class="constructor-list">
        {% for constructor in type_info.constructors %}
        <li class="constructor-item">
          <div class="constructor-row">
            <svg class="icon icon-box"><use xlink:href="#icon-box"></use></svg>
            <pre class="constructor-name"><code class="hljs aiken">{{ constructor.definition }}</code></pre>
          </div>
	  {% if !constructor.documentation.is_empty() %}
          <div class="constructor-item-docs">
            {{ constructor.documentation|safe }}
          </div>
	  {% endif %}
        </li>
        {% endfor %}
      </ul>
      {% else if !type_info.opaque %}
      <h3>Alias</h3>
      <div class="constructor-row">
        <svg class="icon icon-at"><use xlink:href="#icon-at"></use></svg>
        <pre class="constructor-name"><code class="hljs aiken">{{ type_info.definition }}</code></pre>
      </div>
      {% 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>
  </h1>

  {% for constant in constants %}
  <div class="member">
    <div class="member-name">
      <h2 id="{{ constant.name }}"><pre class="hljs language-aiken">{{ constant.definition }}</pre></h2>
      {% if !constant.source_url.is_empty() %}
      <!-- TODO: support source linking
      <a class="member-source" alt="View Source" title="View Source" href="{{ constant.source_url|safe }}">
        &lt;/&gt;
      </a>
      -->
      {% endif %}
    </div>
    <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>
  </h1>
  {% for function in functions %}
  <div class="member">
    <div class="member-name">
      <h2 id="{{ function.name }}"><pre class="hljs language-aiken">{{ function.signature }}</pre></h2>
      {% if !function.source_url.is_empty() %}
      <!-- TODO: support source linking
      <a class="member-source" alt="View Source" title="View Source" href="{{ function.source_url|safe }}">
        &lt;/&gt;
      </a>
      -->
      {% endif %}
    </div>
    <div class="rendered-markdown">{{ function.documentation|safe }}</div>
  </div>
  {% endfor %}
</section>
{% endif %}
{% endblock %}
