2020-01-12 14:33:02 +00:00
|
|
|
{{ $current := .current }}
|
|
|
|
{{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site }}
|
|
|
|
|
2021-01-24 10:58:39 +00:00
|
|
|
<!-- template -->
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ define "menu-file" }}
|
|
|
|
{{ $current := .current }}
|
|
|
|
{{ $site := .site }}
|
|
|
|
|
|
|
|
<ul class="gdoc-nav__list">
|
2020-02-05 15:46:29 +00:00
|
|
|
{{ range sort (default (seq 0) .sect) "weight" }}
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ $current.Scratch.Set "current" $current }}
|
|
|
|
{{ $current.Scratch.Set "site" $site }}
|
|
|
|
|
|
|
|
<li>
|
|
|
|
{{ $ref := default false .ref }}
|
|
|
|
{{ if $ref}}
|
|
|
|
{{ $site := $current.Scratch.Get "site" }}
|
|
|
|
{{ $this := $site.GetPage .ref }}
|
|
|
|
{{ $current := $current.Scratch.Get "current" }}
|
|
|
|
{{ $icon := default false .icon }}
|
2021-01-24 10:58:39 +00:00
|
|
|
{{ $numberOfPages := (add (len $this.Pages) (len $this.Sections)) }}
|
|
|
|
{{ $isCurrent := eq $current $this }}
|
|
|
|
{{ $isAncestor := $this.IsAncestor $current }}
|
|
|
|
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
2021-07-10 11:17:16 +00:00
|
|
|
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
2020-01-12 14:33:02 +00:00
|
|
|
|
2021-07-10 11:17:16 +00:00
|
|
|
{{ if $doCollapse }}
|
2021-01-24 10:58:39 +00:00
|
|
|
<input type="checkbox" id="{{ printf "navtree-%s" $id }}" class="gdoc-nav__toggle" {{ if or $isCurrent $isAncestor }}checked{{ end }}>
|
|
|
|
<label for="{{ printf "navtree-%s" $id }}" class="flex justify-between">
|
|
|
|
{{ end }}
|
2020-01-12 14:33:02 +00:00
|
|
|
<span class="flex">
|
|
|
|
{{ if $icon }}<svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>{{ end }}
|
|
|
|
<a href="{{ if .external }}{{ .ref }}{{ else }}{{ relref $current .ref }}{{ end }}"
|
2021-01-24 10:58:39 +00:00
|
|
|
class="gdoc-nav__entry {{ if not .external }}{{ if $isCurrent }}is-active{{ end }}{{ end }}">
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ .name }}
|
|
|
|
</a>
|
|
|
|
</span>
|
2021-07-10 11:17:16 +00:00
|
|
|
{{ if $doCollapse }}
|
2021-03-03 20:07:59 +00:00
|
|
|
<svg class="icon gdoc_keyborad_arrow_left"><use xlink:href="#gdoc_keyborad_arrow_left"></use></svg>
|
|
|
|
<svg class="icon gdoc_keyborad_arrow_down hidden"><use xlink:href="#gdoc_keyborad_arrow_down"></use></svg>
|
2021-01-24 10:58:39 +00:00
|
|
|
</label>
|
|
|
|
{{ end }}
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ else }}
|
2021-01-24 10:58:39 +00:00
|
|
|
<span class="flex">{{ .name }}</span>
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ end }}
|
|
|
|
|
2021-01-24 10:58:39 +00:00
|
|
|
{{ with .sub }}
|
|
|
|
{{ template "menu-file" dict "sect" . "current" ($current.Scratch.Get "current") "site" ($current.Scratch.Get "site") }}
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ end }}
|
|
|
|
</li>
|
|
|
|
|
|
|
|
{{ end }}
|
|
|
|
</ul>
|
|
|
|
{{ end }}
|