<html>
  {% include "head.dtl" %}
  <body>
    {{ sidenav|safe }}
    <div id="main" class="nav">
      <div id="content">
        <section id="top-section">
          <h1><a id="top">{{ module.name }}</a></h1>
          {% if module.description != "none" %}
          <p>{{ module.description|safe }}</p>
          {% endif %}
        </section>
        {% if module.functions|length > 0 or module.types|length > 0 %}
        <!------- Summary ------->
        <section id="summary-section">
          <h1><a id="summary">Summary</a></h1>

          {% if module.types|length > 0 %}
          <!------- Types summary ------->
          <h2><a id="types">Types</a></h2>
          <ul>
            {% for type in module.types %}
            <li>
              <a href="#{{ type.name }}/{{ type.arity }}">
                <span class="signature">{{ type.name }}()</span>
              </a>
            </li>
            {% endfor %}
          </ul>
          {% endif %}

          {% if module.functions|length > 0 %}
          <!------- Functions summary ------->
          <h2><a id="functions">Functions</a></h2>
          <ul>
            {% for function in module.functions %}
            <li>
              <a href="#{{ function.name }}/{{ function.arity }}">
                <span class="signature">
                  {{ function.name }}({% for arg in function.args %}{{ arg.name }}{% if not forloop.last %}, {% endif %}{% endfor %})
                </span>
              </a>
              {% if function.synopsis != "none" %}
              <div class="synopsis">{{ function.synopsis|safe }}</div>
              {% endif %}
              {% if function.equiv != "none" %}
              <div class="synopsis">Equivalent to <code>{{ function.equiv|safe }}</code>.</div>
              {% endif %}
            </li>
            {% endfor %}
          </ul>
          {% endif %}
        </section>
        {% endif %}

        {% if module.types|length > 0 %}
        <!------- Types details ------->
        <section id="types-section">
          <h1>Types</h1>
          {% for type in module.types %}
          <a id="{{ type.name }}/{{ type.arity }}" href="#{{ type.name }}/{{ type.arity }}">
            <h2 class="type">
              <span class="signature"> {{ type.name }}()</span>
              {% if type.description != "none" %}
              <pre class="definition">{{ type.description|safe }}</pre>
              {% endif %}
            </h2>
          </a>
          {% endfor %}
        </section>
        {% endif %}

        {% if module.functions|length > 0 %}
        <!------- Functions details ------->
        <section id="functions-section">
          <h1>Functions</h1>
          {% for function in module.functions %}
          <a id="{{ function.name }}/{{ function.arity }}" href="#{{ function.name }}/{{ function.arity }}">
            <h2 class="function">
              <span class="signature">
                {{ function.name }}({% for arg in function.args %}{{ arg.name }}{% if not forloop.last %}, {% endif %}{% endfor %})
              </span>
              {% if function.spec != "none" %}
              <pre class="definition">{{ function.spec }}</pre>
              {% endif %}
            </h2>
          </a>
          {% if function.equiv != "none" %}
          <p>Equivalent to <code>{{ function.equiv|safe }}</code>.</p>
          {% endif %}
          {% if function.description != "none" %}
          <p>{{ function.description|safe }}</p>
          {% endif %}
          {% endfor %}
        </section>
        {% endif %}
      </div>
    </div>
  </body>
</html>
