{% from 'icons.html.jinja' import show_icon_map, input_icon_map %}
{% set toc_label %}
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
    <path d="M3 4h4v4H3zm6 1v2h12V5zm-6 5h4v4H3zm6 1v2h12v-2zm-6 5h4v4H3zm6 1v2h12v-2z"></path>
  </svg>
  <span class="md-ellipsis" style="vertical-align: top;">Glossary</span>
{% endset %}
{% filter heading(context.options.start_level+1, id="glossary", toc_label=toc_label) %}
  <span class="md-icon" style="vertical-align: middle; display: inline-block">{{ ":material-format-list-bulleted-square:"|convert_markdown(3) }}</span><span style="vertical-align: middle;">Glossary</span>
{% endfilter %}
{% for glossary_predicate in context.glossary.predicates %}
  {% set predicate = glossary_predicate.info %}
  {% set pred_sig %}
    <code class="doc-symbol doc-symbol-heading doc-clingo-symbol-predicate"
          style="font-size: 0.6rem"></code>
    <code style="font-size: 0.6rem;">{{ predicate }}</code>
  {% endset %}
  {% set predicate_id = predicate.signature | replace("/", "-") %}
  {% set pred_toc %}
    <span class="md-ellipsis"
          style="display: inline-flex;
                 align-items: center;
                 gap: 0.3rem">
      <code class="doc-symbol doc-symbol-heading doc-clingo-symbol-predicate"
            style="font-size: 0.6rem"></code>
      {{ input_icon_map[predicate.is_input]|safe }}
      {{ show_icon_map[predicate.show_status]|safe }}
      <code style="font-size: 0.6rem;">{{ predicate }}</code>
    </span>
  {% endset %}
  {% filter heading(context.options.start_level+2, id=predicate_id, toc_label=pred_toc) %}
    {{ pred_sig }}
  {% endfilter %}
  <div>
    {%- if predicate.description %}{{ predicate.description | convert_markdown(5, html_id) }}{% endif %}
    {%- if predicate.arguments %}
      <table>
        <thead>
          <tr>
            <th>Parameter</th>
            <th>Description</th>
          </tr>
        </thead>
        <tbody>
          {%- for argument in predicate.arguments %}
            <tr>
              <td>
                <code>{{ argument.identifier }}</code>
              </td>
              <td>{{ argument.description | convert_markdown(5, html_id) }}</td>
            </tr>
          {%- endfor %}
        </tbody>
      </table>
    {%- endif %}
    {% if context.options.glossary.include_references %}
      {% include "glossary_references.html.jinja" %}
    {% endif %}
  </div>
  <p>
    <br>
  </p>
{%- endfor %}
