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) */}}
|
2020-04-14 22:56:31 +02:00
|
|
|
{{ $self := eq .CurrentPage .Section }}
|
2020-04-28 22:00:24 +02:00
|
|
|
{{ $ancestor := .Section.IsAncestor .CurrentPage }}
|
2020-04-11 14:35:29 +02:00
|
|
|
{{ $collapsed := .Section.Params.bookCollapseSection }}
|
2019-10-09 01:00:26 +02:00
|
|
|
|
2020-04-14 22:56:31 +02:00
|
|
|
{{ if or $self $ancestor (not $collapsed) }}
|
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>
|
2019-10-09 01:00:26 +02:00
|
|
|
{{ end }}
|
2018-09-18 01:35:54 +02:00
|
|
|
{{ 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) */}}
|
|
|
|
{{ if .Page.Content }}
|
|
|
|
<a href="{{ .Page.RelPermalink }}" class="
|
|
|
|
{{- if and .Page.Params.bookCollapseSection .Page.IsSection }}collapsed {{ end }}
|
2020-04-14 22:56:31 +02:00
|
|
|
{{- if eq .CurrentPage .Page }}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 }}
|