Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bep/docuapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhosrow Moossavi <khos2ow@gmail.com>2021-08-27 20:33:51 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-08-28 23:12:23 +0300
commit0168f8e5ac0e90549f92fc1512bea95a2ac3fa14 (patch)
treef6d259b922d01c5bd39991e0630aeada8c35efd9
parent7210745f287e2d24c410ab3ae4c178163d69591e (diff)
Fix TOC rendering issuesv1.5.2
While rendering TOC, some items were lost. For example: - if last h1 has some children or grand children - if any h1 has multiple h2 (without any h3) Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
-rw-r--r--exampleSite/content/errors.md6
-rw-r--r--layouts/partials/funcs/toc_from_pages.html6
2 files changed, 12 insertions, 0 deletions
diff --git a/exampleSite/content/errors.md b/exampleSite/content/errors.md
index db7949e..9cbfdee 100644
--- a/exampleSite/content/errors.md
+++ b/exampleSite/content/errors.md
@@ -10,6 +10,7 @@ title: Errors
The Kittn API uses the following error codes:
+## 4xx
Error Code | Meaning
---------- | -------
@@ -22,5 +23,10 @@ Error Code | Meaning
410 | Gone -- The kitten requested has been removed from our servers
418 | I'm a teapot
429 | Too Many Requests -- You're requesting too many kittens! Slow down!
+
+## 5xx
+
+Error Code | Meaning
+---------- | -------
500 | Internal Server Error -- We had a problem with our server. Try again later.
503 | Service Unavailable -- We're temporarially offline for maintanance. Please try again later.
diff --git a/layouts/partials/funcs/toc_from_pages.html b/layouts/partials/funcs/toc_from_pages.html
index 1317b74..456f8a6 100644
--- a/layouts/partials/funcs/toc_from_pages.html
+++ b/layouts/partials/funcs/toc_from_pages.html
@@ -40,6 +40,9 @@
{{ $h2s = $h2s | append $tocItem }}
{{ $h3s = slice }}
{{ end }}
+ {{ if eq $previousLevel 2 }}
+ {{ $h2s = $h2s | append $previousH2 }}
+ {{ end }}
{{ $previousH2 = $item }}
{{ else }}
{{ $h3s = $h3s | append $item }}
@@ -50,6 +53,9 @@
{{ end }}
{{ if ne $previousLevel 0 }}
+ {{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
+ {{ $h2s = $h2s | append $tocItem }}
+
{{ $item := merge $previousH1 (dict "sub" $h2s) }}
{{ $toc = $toc | append $item }}
{{ end }}