summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-07-07 09:05:22 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-07-07 09:05:22 +0200
commit6a9aecc9a83f5643374af2c67d06120f4cab127f (patch)
treed743af1689aa38b07bc97bdca26a656deaa1ea21
parente943b51bb13f187aa3d317033206643ea96343e2 (diff)
Make macro recursive
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--templates/index.html2
-rw-r--r--templates/macro.html20
-rw-r--r--templates/section.html2
3 files changed, 8 insertions, 16 deletions
diff --git a/templates/index.html b/templates/index.html
index 4374b7c..1752e61 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -27,7 +27,7 @@
{% endfor %}
</ul>
<h1>{{ config.title }}</h1>
- {{ macro::tree() }}
+ {{ macro::tree(sec=section) }}
{% endblock nav %}
</nav>
diff --git a/templates/macro.html b/templates/macro.html
index c89f094..242b42e 100644
--- a/templates/macro.html
+++ b/templates/macro.html
@@ -1,23 +1,15 @@
-{% macro tree() %}
+{% macro tree(sec) %}
<a href="javascript:void(0);" onclick="burger()" id="mobile">&#9776;</a>
<ul id="bger">
- {% for subsection in section.subsections | sort %}
+ {% for subsection in sec.subsections | sort %}
{% set subsection_item = get_section(path=subsection) %}
<li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAaElEQVRIx2NgGOqAEcZgZefQb25suIBPcW19g8Hvnz8ukmwBKzuHQHNjw3tiNFRUVDCSZAExLicX1NY3ODJ2dHT8ZxgF+OKA1kHERGsfjFowasGoBaMWEGNBbX2DI60Mr61vkBr69QEAFDIY9Yz1owAAAAAASUVORK5CYII=" width="16px" />&nbsp;<a href="{{ subsection_item.permalink | safe }}">{{ subsection_item.title }}</a></li>
<ul id="subpages">
-
- {% for subsc in subsection_item.subsections | sort %}
- <li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAaElEQVRIx2NgGOqAEcZgZefQb25suIBPcW19g8Hvnz8ukmwBKzuHQHNjw3tiNFRUVDCSZAExLicX1NY3ODJ2dHT8ZxgF+OKA1kHERGsfjFowasGoBaMWEGNBbX2DI60Mr61vkBr69QEAFDIY9Yz1owAAAAAASUVORK5CYII=" width="16px" />&nbsp;<a href="{{ subsection_item.permalink | safe }}">{{ subsection_item.title }}</a></li>
- {% endfor %}
-
- {% for subpage in subsection_item.pages %}
- <li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AUDFDoqfmnPqQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC6SURBVEjH7ZTBCcIwFIa/lO6hA7iA6BCO4AZe/xHeCF49C4I7VOfQk2PUS4QibUzahiL0h0AOj7x87wtx+JhZTWQkLYFnTG1Bj5jZBVjE1LpvAknux+F1CkkvgkazB7DJ0kDSHniZ2RFY5yA4SToAKzO7d5EUoVk3V0fZWdLO11dt4gc58Ll62a1OBr2igJ8tcBuLoO0S1Wdfpt40lTALQTNlYI5ujAbTEaT8riHi2cHs4B8dpM5+coI3MpVSlNj0qyUAAAAASUVORK5CYII=" width="16px" />&nbsp;<a href="{{ subpage.permalink | safe }}">{{ subpage.title }}</a></li>
- {% endfor %}
+ {{ macro::tree(sec=subsection_item) }}
</ul>
- {% else %}
- {% for subpage in section.pages %}
- <li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AUDFDoqfmnPqQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC6SURBVEjH7ZTBCcIwFIa/lO6hA7iA6BCO4AZe/xHeCF49C4I7VOfQk2PUS4QibUzahiL0h0AOj7x87wtx+JhZTWQkLYFnTG1Bj5jZBVjE1LpvAknux+F1CkkvgkazB7DJ0kDSHniZ2RFY5yA4SToAKzO7d5EUoVk3V0fZWdLO11dt4gc58Ll62a1OBr2igJ8tcBuLoO0S1Wdfpt40lTALQTNlYI5ujAbTEaT8riHi2cHs4B8dpM5+coI3MpVSlNj0qyUAAAAASUVORK5CYII=" width="16px" />&nbsp;<a href="{{ subpage.permalink | safe }}">{{ subpage.title }}</a></li>
- {% endfor %}
+ {% endfor %}
+ {% for subpage in sec.pages %}
+ <li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AUDFDoqfmnPqQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC6SURBVEjH7ZTBCcIwFIa/lO6hA7iA6BCO4AZe/xHeCF49C4I7VOfQk2PUS4QibUzahiL0h0AOj7x87wtx+JhZTWQkLYFnTG1Bj5jZBVjE1LpvAknux+F1CkkvgkazB7DJ0kDSHniZ2RFY5yA4SToAKzO7d5EUoVk3V0fZWdLO11dt4gc58Ll62a1OBr2igJ8tcBuLoO0S1Wdfpt40lTALQTNlYI5ujAbTEaT8riHi2cHs4B8dpM5+coI3MpVSlNj0qyUAAAAASUVORK5CYII=" width="16px" />&nbsp;<a href="{{ subpage.permalink | safe }}">{{ subpage.title }}</a></li>
{% endfor %}
</ul>
{% endmacro tree %}
diff --git a/templates/section.html b/templates/section.html
index 3b82895..bdd02a0 100644
--- a/templates/section.html
+++ b/templates/section.html
@@ -11,5 +11,5 @@
<li>{{ section.title }}</li>
</ul>
<h1>{{ section.title }}</h1>
- {{ macro::tree() }}
+ {{ macro::tree(sec=section) }}
{% endblock nav %}