summaryrefslogtreecommitdiffstats
path: root/templates/macros.html
blob: 6c6020af526fd17b3f3d1a4f3f0998988f0b8633 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{% macro tags(tags) %}
  {% for tag in tags -%}
    <a href="{{ get_taxonomy_url(kind="tags", name=tag ) }}">#{{ tag }}</a>
  {% endfor -%}
{% endmacro tags %}
{% macro nav_item(name, url) %}
  {%- if page %}
    {%- set this = page %}
  {%- elif section %}
    {%- set this = section %}
  {%- endif %}
  <a {% if this.permalink == url %}class="active"{%- endif %} href={{ url }}>{{ name }}</a>
{% endmacro nav %}
{% macro toc(page) %}
  {% if page.toc %}
    <nav class="toc">
      <ul>
        {% for h1 in page.toc %}
          <li>
            <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
            {% if h1.children %}
              <ul>
                {% for h2 in h1.children %}
                  <li>
                    <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
                  </li>
                  {% if h2.children %}
                    <ul>
                      {% for h3 in h2.children %}
                        <li>
                          <a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
                          {% if h3.children %}
                            <ul>
                              {% for h4 in h3.children %}
                                <li>
                                  <a href="{{ h4.permalink | safe }}">{{ h4.title }}</a>
                                </li>
                                {% if h4.children %}
                                  <ul>
                                    {% for h5 in h4.children %}
                                      <li>
                                        <a href="{{ h5.permalink | safe }}">{{ h5.title }}</a>
                                        {% if h5.children %}
                                          <ul>
                                            {% for h6 in h5.children %}
                                              <li>
                                                <a href="{{ h5.permalink | safe }}">{{ h6.title }}</a>
                                              </li>
                                            {% endfor %}
                                          </ul>
                                        {% endif %}
                                      </li>
                                    {% endfor %}
                                  </ul>
                                {% endif %}
                              {% endfor %}
                            </ul>
                          {% endif %}
                        </li>
                      {% endfor %}
                    </ul>
                  {% endif %}
                {% endfor %}
              </ul>
            {% endif %}
          </li>
        {% endfor %}
      </ul>
    </nav>
  {% endif %}
{% endmacro %}