summaryrefslogtreecommitdiff
path: root/website/templates/macros.html
blob: c40abe53b17a7746db2c07a064da1be611b4ba77 (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
{% macro toc() %}
    <p class="p-1 my-4 text-base rounded-sm sm:hidden bg-yellow-200/20">Landscape mode recommended on mobile devices</p>

    {%- if page.toc -%}
        {% set_global toc = page.toc %}
    {%- else -%}
        {% set_global toc = section.toc %}
    {%- endif -%}

    {% if toc %}
        <div class="px-4 py-0.5 my-3 border-s-4 rounded-xl border-double">
            <nav>
                <ul class="ml-0 list-none">
                    {% for parent in toc %}
                        {% if parent.level == 2 %}
                            <li>
                                {#- -#}
                                <a href="{{ parent.permalink | safe }}">{{ parent.title }}</a>
                                {#- -#}
                                {% if parent.children %}
                                    <ul class="my-0 ml-5 list-none">
                                        {% for child in parent.children %}
                                            {% if child.level == 3 %}
                                                <li>
                                                    {#- -#}
                                                    <a class="text-base" href="{{ child.permalink | safe }}">{{ child.title }}</a>
                                                    {#- -#}
                                                </li>
                                            {% endif %}
                                        {% endfor %}
                                    </ul>
                                {% endif %}
                                {#- -#}
                            </li>
                        {% endif %}
                    {% endfor %}
                </ul>
            </nav>
        </div>
    {% endif %}
{% endmacro %}

{% macro btn(link, content) %}
    <a class="py-1.5 px-3 my-2 no-underline bg-gray-800 rounded-xl transition duration-500 hover:scale-[1.02]"
       href="{{ link | safe }}">{{ content | safe }}</a>
{% endmacro %}