{{ $s := partialCached "scratch.html" . }}

{{ $currentNode := . }}
{{ $currentDir := "" }}
{{ with .File }}
  {{ $currentDir = .Dir }}
{{ end }}
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}

<div class="{{ $scratch.depth }}title"><span class="sup">{{ substr $currentDir 0 -1 }}⁄{{ substr .Title 0 1  }}</span>{{ substr .Title 1 }}</div></div>

<div class="grid">
    <div class="leftcolumn">
        {{ if ne (trim .Page.TableOfContents "\n") "<nav id=\"TableOfContents\"></nav>" }}
          {{ .Page.TableOfContents }}
        {{ end }}
    </div>
    <div class="rightcolumn">
        {{ if and (not (eq $scratch.depth "crust")) $scratch.has_children }}
        <div class="has">
            {{ with $scratch.has }}
              <span class="sup">has {{ $scratch.has }}⁄</span>
            {{ end }}
        </div>
        <div class="afterhas">
          {{ range $scratch.has_children }}
            <div class="{{ $scratch.child_depth }}">
              <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
            </div>
          {{ end }}
        {{ end }}

        {{ if eq $scratch.depth "crust" }}
            <div class="has">
                <span class="sup">in {{ index $scratch.in 1 }}⁄</span>
            </div>
            <div class="afterhas">
                {{ range $scratch.is_in }}
                <div class="{{ substr $currentDir 0 -1 }}">
                    <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
                </div>
            {{ end }}
          {{ end }}
        </div>
    </div>
</div>

