roxy-docs/includes/macros.html
2024-02-21 09:10:31 -05:00

30 lines
1.7 KiB
HTML

{% macro menu_items(key="") %}
{% for page in pages | get(key=key, default=pages) | unzip | filter(attribute="1.order") | sort(attribute="1.order") %}
{% set parent = key %}
{% set key = page.0 %}
{% set value = page.1 %}
{% if value.type and value.type == "page" %}
<li><a href="{{value.path}}">{{value.title}}</a></li>
{% elif value.type and value.type == "category" %}
{% set next = [parent, key] | join(sep=".") | trim_start_matches(pat=".") %}
</menu>
<details open>
<summary>
{{value.title}}
</summary>
<menu class="menu-item-list">
{{ self::menu_items(key=next) }}
</menu>
</details>
<menu class="menu-item-list">
{% endif %}
{% endfor %}
{% endmacro category %}
{% macro icon(name, size="24") %}
{% if name == "git" -%}
<svg class="icon git" height="{{size}}" width="{{size}}" xmlns="http://www.w3.org/2000/svg" width="92pt" height="92pt" viewBox="0 0 92 92"><defs><clipPath id="a"><path d="M0 .113h91.887V92H0Zm0 0"/></clipPath></defs><g clip-path="url(#a)"><path style="stroke:none;fill-rule:nonzero;fill:#fff;fill-opacity:1" d="M90.156 41.965 50.036 1.848a5.918 5.918 0 0 0-8.372 0l-8.328 8.332 10.566 10.566a7.03 7.03 0 0 1 7.23 1.684 7.034 7.034 0 0 1 1.669 7.277l10.187 10.184a7.028 7.028 0 0 1 7.278 1.672 7.04 7.04 0 0 1 0 9.957 7.05 7.05 0 0 1-9.965 0 7.044 7.044 0 0 1-1.528-7.66l-9.5-9.497V59.36a7.04 7.04 0 0 1 1.86 11.29 7.04 7.04 0 0 1-9.957 0 7.04 7.04 0 0 1 0-9.958 7.06 7.06 0 0 1 2.304-1.539V33.926a7.049 7.049 0 0 1-3.82-9.234L29.242 14.272 1.73 41.777a5.925 5.925 0 0 0 0 8.371L41.852 90.27a5.925 5.925 0 0 0 8.37 0l39.934-39.934a5.925 5.925 0 0 0 0-8.371"/></g></svg>
{% endif %}
{% endmacro icon %}