aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent <vincent@deuxfleurs.fr>2022-09-25 16:11:47 +0200
committervincent <vincent@deuxfleurs.fr>2022-09-25 16:31:57 +0200
commit4f9f86a32b3a40c9c443f5603b46af7210a4b978 (patch)
treeba4a4c2c90bfa57c5876435c03ad712d96a6c3d1
parentf8b5a2e1baaac3dd384d9a7039c5adaf8e7b194e (diff)
downloadguide.deuxfleurs.fr-4f9f86a32b3a40c9c443f5603b46af7210a4b978.tar.gz
guide.deuxfleurs.fr-4f9f86a32b3a40c9c443f5603b46af7210a4b978.zip
Classement mixte terminé
-rw-r--r--templates/_nav.html66
1 files changed, 52 insertions, 14 deletions
diff --git a/templates/_nav.html b/templates/_nav.html
index 1188b5d..3bfda07 100644
--- a/templates/_nav.html
+++ b/templates/_nav.html
@@ -3,8 +3,9 @@
{% set sec = get_section(path=sec) %}
{% set maxlevel = hierarchy | length %}
+
{# Ici on regarde si toutes les sous-sections et pages contenues ont #}
- {# une variable weight_custom #}
+ {# une variable weight_custom. Au passage on note ces poids. #}
{% set temoin = true %}
{% set liste = [] %}
{% if sec.subsections %}
@@ -13,7 +14,7 @@
{% if not s_temp.extra.weight_custom %}
{% set_global temoin = false %}
{% else %}
- {% set_global liste = liste | concat(with=s_temp) %}
+ {% set_global liste = liste | concat(with=s_temp.extra.weight_custom) %}
{% endif %}
{% endfor %}
{% endif %}
@@ -22,25 +23,62 @@
{% if not p.extra.weight_custom %}
{% set_global temoin = false %}
{% else %}
- {% set_global liste = liste | concat(with=p) %}
+ {% set_global liste = liste | concat(with=p.extra.weight_custom) %}
{% endif %}
{% endfor %}
{% endif %}
+
{# Si toutes les sous-sections et pages ont une variable weight_custom, #}
{# on classe selon elle. Sinon, on utilise la méthode classique. #}
{% if temoin %}
- // classer ici
-
-
-
-
-
-
-
-
-
-
+ {% set_global liste = liste | sort %}
+ {% for x in liste %}
+ {% if sec.subsections %}
+ {% for y in sec.subsections %}
+ {% set p = get_section(path=y) %}
+ {% if p.extra.weight_custom == x %}
+ <div class="toc-item">
+ {% if p.subsections or p.pages %}
+ {% if p.path == current.path %}
+ <a class="subtext" href="{{ p.permalink | safe}}">‣ <b>{{ p.title }}</b></a>
+ {% elif hierarchy is containing(y) %}
+ <a class="subtext" href="{{ p.permalink | safe}}">‣ {{ p.title }}</a>
+ {% else %}
+ <a class="subtext" href="{{ p.permalink | safe}}">‣ {{ p.title }}</a>
+ {% endif %}
+ {% if hierarchy is containing(y) or current.path == p.path %}
+ {% if level + 1 < maxlevel %}
+ <div class="nav-subsection">
+ {{ nav::navsection(hierarchy=hierarchy,level=level + 1,current=current) }}
+ </div>
+ {% endif %}
+ {% endif %}
+ {% else %}
+ {% if p.path == current.path %}
+ <a class="subtext" href="{{p.permalink | safe}}"><b>{{ p.title }}</b></a>
+ {% else %}
+ <a class="subtext" href="{{p.permalink | safe}}">{{ p.title }}</a>
+ {% endif %}
+ {% endif %}
+ </div>
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% if sec.pages %}
+ {% for p in sec.pages %}
+ {% if p.extra.weight_custom == x %}
+ <div class="toc-item">
+ {% if p.path == current.path %}
+ <a class="subtext" href="{{p.permalink | safe}}"><b>{{ p.title }}</b></a>
+ {% else %}
+ <a class="subtext" href="{{p.permalink | safe}}">{{ p.title }}</a>
+ {% endif %}
+ </div>
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% endfor %}
{% else %}
{% if sec.subsections %}
{% for s in sec.subsections %}