2019-04-22 19:17:39 +02:00
|
|
|
{{ $bookSection := default "docs" .Site.Params.BookSection }}
|
|
|
|
{{ if eq $bookSection "*" }}
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ $bookSection = "/" }}{{/* Backward compatibility */}}
|
2019-04-22 19:17:39 +02:00
|
|
|
{{ end }}
|
2018-09-05 16:22:04 +02:00
|
|
|
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ with .Site.GetPage $bookSection }}
|
|
|
|
{{ template "book-section-children" (dict "Section" . "CurrentPage" $) }}
|
2019-04-22 19:17:39 +02:00
|
|
|
{{ end }}
|
|
|
|
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}}
|
2019-04-22 19:17:39 +02:00
|
|
|
<ul>
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ range (where .Section.Pages "Params.bookhidden" "ne" true) }}
|
2020-03-30 18:00:15 +02:00
|
|
|
{{ if .IsSection }}
|
2020-04-11 14:35:29 +02:00
|
|
|
<li {{- if .Params.BookFlatSection }} class="book-section-flat" {{ end -}}>
|
|
|
|
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
|
|
|
{{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
|
|
|
|
</li>
|
2020-03-30 18:00:15 +02:00
|
|
|
{{ else if and .IsPage .Content }}
|
2019-08-29 06:53:19 +02:00
|
|
|
<li>
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
2019-08-29 06:53:19 +02:00
|
|
|
</li>
|
|
|
|
{{ end }}
|
2018-09-17 18:29:36 +02:00
|
|
|
{{ end }}
|
2018-09-18 01:35:54 +02:00
|
|
|
</ul>
|
|
|
|
{{ end }}
|
2019-10-09 01:00:26 +02:00
|
|
|
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}}
|
2020-09-14 22:45:31 +02:00
|
|
|
{{ $current := eq .CurrentPage .Page }}
|
|
|
|
{{ $ancestor := .Page.IsAncestor .CurrentPage }}
|
|
|
|
|
|
|
|
{{ if .Page.Params.bookCollapseSection }}
|
|
|
|
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
|
|
|
|
<label for="section-{{ md5 .Page }}" class="flex justify-between">
|
2022-02-18 17:35:02 +01:00
|
|
|
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
|
2020-09-14 22:45:31 +02:00
|
|
|
{{- partial "docs/title" .Page -}}
|
|
|
|
</a>
|
|
|
|
</label>
|
|
|
|
{{ else if .Page.Content }}
|
2022-02-18 17:35:02 +01:00
|
|
|
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }} active{{ end }}">
|
2020-04-11 14:35:29 +02:00
|
|
|
{{- partial "docs/title" .Page -}}
|
|
|
|
</a>
|
2020-02-29 21:15:52 +01:00
|
|
|
{{ else }}
|
2020-04-11 14:35:29 +02:00
|
|
|
<span>{{- partial "docs/title" .Page -}}</span>
|
2020-02-29 21:15:52 +01:00
|
|
|
{{ end }}
|
2019-04-22 19:17:39 +02:00
|
|
|
{{ end }}
|