Optimized menu

This commit is contained in:
Kevin Veen-Birkenbach 2025-03-17 04:13:24 +01:00
parent 9194abee4a
commit 9a30e0f49b
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E

View File

@ -1,36 +1,43 @@
{% macro render_headings(headings, level=1) %} {% macro render_headings(headings, level=1) %}
<ul class="toctree-l{{ level }}"> <ul class="toctree-l{{ level }}" style="list-style: none; padding-left: 0;">
{% for item in headings %} {% for item in headings %}
<li class="toctree-l{{ level }}{% if item.current %} current{% endif %}" <li class="toctree-l{{ level }}{% if item.current %} current{% endif %}"
{% if item.children %} x-data="{ expanded: false }" {% endif %}> {% if item.children %} x-data="{ expanded: false }" {% endif %}
<a class="reference internal{% if item.children %} expandable{% endif %}" style="white-space: nowrap;">
href="{{ pathto(item.link).replace('#', '') }}{% if item.anchor %}#{{ item.anchor }}{% endif %}" <div class="menu-item" style="display: inline-flex; align-items: center; justify-content: space-between; width: 100%; white-space: nowrap;">
{% if item.children %} <!-- Link- und "Datei öffnen"-Bereich -->
@click.prevent="expanded = !expanded" <div style="display: inline-flex; align-items: center; white-space: nowrap;">
:class="{ 'expanded': expanded }" <a class="reference internal{% if item.children %} expandable{% endif %}"
{% endif %}> href="{{ pathto(item.link).replace('#', '') }}{% if item.anchor %}#{{ item.anchor }}{% endif %}"
{{ item.text }} style="text-decoration: none; white-space: nowrap;">
{% if item.children %} {{ item.text }}
<button @click.prevent.stop="expanded = !expanded" type="button" class="toggle-button" style="background: none; border: none; padding: 0; margin-left: 5px;"> </a>
<span x-show="!expanded"> </div>
<svg fill="currentColor" height="18px" stroke="none" viewBox="0 0 24 24" width="18px" xmlns="http://www.w3.org/2000/svg"> <!-- Expand-Toggle-Button -->
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path> {% if item.children %}
</svg> <button @click.prevent.stop="expanded = !expanded" type="button" class="toggle-button"
</span> style="background: none; border: none; padding: 0; margin-left: auto;">
<span x-show="expanded">&#9660;</span> <span x-show="!expanded">
</button> <svg fill="currentColor" height="18px" stroke="none" viewBox="0 0 24 24" width="18px"
{% endif %} xmlns="http://www.w3.org/2000/svg">
</a> <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path>
{% if item.children %} </svg>
<div x-show="expanded"> </span>
{{ render_headings(item.children, level+1) }} <span x-show="expanded">&#9660;</span>
</button>
{% endif %}
</div> </div>
{% endif %} {% if item.children %}
</li> <div x-show="expanded">
{% endfor %} {{ render_headings(item.children, level+1) }}
</div>
{% endif %}
</li>
{% endfor %}
</ul> </ul>
{% endmacro %} {% endmacro %}
{% if local_md_headings or local_subfolders %} {% if local_md_headings or local_subfolders %}
<div class="local-md-headings"> <div class="local-md-headings">
<h3 class="toctree-l1">Index</h3> <h3 class="toctree-l1">Index</h3>