From c5caa6db1e7ca0ec44c1a044d98a7dd5e130c050 Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux <hugo@trentesaux.fr> Date: Sun, 11 Oct 2020 20:15:18 +0200 Subject: [PATCH] [feat] add toc for external content other option is to add [toc] tag directly inside content --- content/wiki/forger-des-blocs/duniter1.9doc/_index.md | 1 + .../wiki/forger-des-blocs/duniter1.9doc/advanced-commands.md | 1 + content/wiki/forger-des-blocs/duniter1.9doc/configure.md | 1 + content/wiki/forger-des-blocs/duniter1.9doc/docker.md | 1 + content/wiki/forger-des-blocs/duniter1.9doc/install.md | 1 + .../wiki/forger-des-blocs/duniter1.9doc/manual_compilation.md | 1 + .../forger-des-blocs/duniter1.9doc/ws2p_preferred_privileged.md | 1 + templates/page.html | 2 ++ templates/section.html | 2 ++ 9 files changed, 11 insertions(+) diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/_index.md b/content/wiki/forger-des-blocs/duniter1.9doc/_index.md index 23656b3..2cbc056 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/_index.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/_index.md @@ -3,4 +3,5 @@ title = "Documentation pour Duniter 1.9" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/index.md" +auto_toc = true +++ \ No newline at end of file diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/advanced-commands.md b/content/wiki/forger-des-blocs/duniter1.9doc/advanced-commands.md index c2b1025..980aeb9 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/advanced-commands.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/advanced-commands.md @@ -3,4 +3,5 @@ title = "Advanced commands" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/advanced-commands.md" +auto_toc = true +++ \ No newline at end of file diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/configure.md b/content/wiki/forger-des-blocs/duniter1.9doc/configure.md index d7d2dcd..fed123a 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/configure.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/configure.md @@ -3,4 +3,5 @@ title = "Configure" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/configure.md" +auto_toc = true +++ \ No newline at end of file diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/docker.md b/content/wiki/forger-des-blocs/duniter1.9doc/docker.md index 45a8832..12ab4a1 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/docker.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/docker.md @@ -3,4 +3,5 @@ title = "Docker" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/docker.md" +auto_toc = true +++ \ No newline at end of file diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/install.md b/content/wiki/forger-des-blocs/duniter1.9doc/install.md index cf5d5a4..19b7980 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/install.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/install.md @@ -3,4 +3,5 @@ title = "Install" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/install.md" +auto_toc = true +++ \ No newline at end of file diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/manual_compilation.md b/content/wiki/forger-des-blocs/duniter1.9doc/manual_compilation.md index 9a5010a..296e185 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/manual_compilation.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/manual_compilation.md @@ -3,4 +3,5 @@ title = "Manual compilation" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/manual_compilation.md" +auto_toc = true +++ \ No newline at end of file diff --git a/content/wiki/forger-des-blocs/duniter1.9doc/ws2p_preferred_privileged.md b/content/wiki/forger-des-blocs/duniter1.9doc/ws2p_preferred_privileged.md index ceb7838..62b3467 100644 --- a/content/wiki/forger-des-blocs/duniter1.9doc/ws2p_preferred_privileged.md +++ b/content/wiki/forger-des-blocs/duniter1.9doc/ws2p_preferred_privileged.md @@ -3,4 +3,5 @@ title = "WS2P preferred and privileged nodes" [extra] EXTERNAL_CONTENT = "https://git.duniter.org/nodes/typescript/duniter/-/raw/dev/doc/use/ws2p_preferred_privileged.md" +auto_toc = true +++ \ No newline at end of file diff --git a/templates/page.html b/templates/page.html index f68e867..2637f01 100644 --- a/templates/page.html +++ b/templates/page.html @@ -11,6 +11,8 @@ <div class="breadcrumb">{{ macros::breadcrumb(path=page.components | safe) }}<a class="w3-text-light-blue" href="https://git.42l.fr/HugoTrentesaux/zola-duniter/src/branch/master/content/{{ page.components | join(sep='/') }}.md">.md</a></div> {{ macros::taxonomies(taxonomies=page.taxonomies) }} + + {% if page.extra.auto_toc %}{{ macros::toc(toc=page.toc, level=1, depth=page.extra.toc_depth | default(value=6)) }}{% endif %} {{ macros::replace_toc(resource=page) | safe }} </main> diff --git a/templates/section.html b/templates/section.html index 59cfa2f..7304cf9 100644 --- a/templates/section.html +++ b/templates/section.html @@ -14,6 +14,8 @@ {#{ macros::taxonomies(taxonomies=section.taxonomies) }#} + {% if section.extra.auto_toc %}{{ macros::toc(toc=section.toc, level=1, depth=section.extra.toc_depth | default(value=6)) }}{% endif %} + {{ macros::replace_toc(resource=section) | safe }} </main> {% endblock content %} \ No newline at end of file -- GitLab