aboutsummaryrefslogtreecommitdiff
path: root/documentation/themes/beastie/layouts/partials/menu.html
blob: 1b3ddf3b7da84bd6e51425b97fb3d3050b966a54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{{ with .Site.GetPage .Params.path }}
  <ul>
    {{ range .Pages }}
      <li>
        {{ if ne .Page.File.LogicalName "book.adoc" }}

          {{ $toc := htmlUnescape .Page.TableOfContents }}
          {{ $toc = replace $toc "<nav id=\"TableOfContents\">" "" }}
          {{ $toc = replace $toc "</nav>" "" }}

          <input type="checkbox" id="chapter-{{ md5 .Page }}" class="toggle" {{ if eq .Page.Permalink $.Permalink }} checked {{ end }} />
          <label {{ if gt (len $toc) 0 }} class="icon cursor" {{ end }} for="chapter-{{ md5 .Page }}"><a role="button"></a></label>

          {{ if $.Site.Params.isOnline }}
            {{ $finalPath := printf "%s%s" .Page.Permalink "#" }}
            <a href="{{ .Page.Permalink }}">
              {{ .Page.Title }}
            </a>
            {{ $toc = replace $toc "#" $finalPath }}
            {{ $toc | safeHTML }}
          {{ else }}
            {{ $chapterPath := printf "%s%s" .Page.Permalink "index.html" }}
            <a href="{{$chapterPath}}">
              {{ .Page.Title }}
            </a>
            {{ $chapterPath = replace $chapterPath "index.html" "index.html#" }}
            {{ $toc = replace $toc "#" $chapterPath }}
            {{ $toc | safeHTML }}
          {{ end }}

        {{ end }}
      </li>
    {{ end }}
  </ul>
{{ end }}