every Page has .Scratch *and* where could be nested...
This commit is contained in:
parent
390f2e4b84
commit
6b345bfa41
|
@ -1,21 +1,20 @@
|
|||
{{ define "main" }}
|
||||
{{$currentNode := . }}
|
||||
|
||||
{{ $graphOptions := newScratch }}
|
||||
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
|
||||
{{ if eq (substr $currentNode.File.Dir 0 -1) $k }}
|
||||
{{ $graphOptions.Set "plural" (index $v "plural") }}
|
||||
{{ $graphOptions.Set "depth" (index $v "depth") }}
|
||||
{{ $.Scratch.Set "plural" (index $v "plural") }}
|
||||
{{ $.Scratch.Set "depth" (index $v "depth") }}
|
||||
{{ with index $v "in" }}
|
||||
{{ $graphOptions.Set "in" (index $v "in") }}
|
||||
{{ $.Scratch.Set "in" (index $v "in") }}
|
||||
{{ end }}
|
||||
{{ with index $v "has" }}
|
||||
{{ $graphOptions.Set "has" (index $v "has") }}
|
||||
{{ $.Scratch.Set "has" (index $v "has") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="{{ $graphOptions.Get "depth" }}title"><span class="sup">{{ substr .File.Dir 0 -1 }}⁄{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
|
||||
<div class="{{ $.Scratch.Get "depth" }}title"><span class="sup">{{ substr .File.Dir 0 -1 }}⁄{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
|
||||
|
||||
<div class="grid">
|
||||
<div class="leftcolumn">
|
||||
|
@ -24,26 +23,27 @@
|
|||
{{ end }}
|
||||
</div>
|
||||
<div class="rightcolumn">
|
||||
{{ if (not (eq ($graphOptions.Get "depth") "crust")) }}
|
||||
{{ if (not (eq ($.Scratch.Get "depth") "crust")) }}
|
||||
<div class="has">
|
||||
<span class="sup">has {{ index ($graphOptions.Get "has") 1 }}⁄</span>
|
||||
<span class="sup">has {{ index ($.Scratch.Get "has") 1 }}⁄</span>
|
||||
</div>
|
||||
<div class="afterhas">
|
||||
{{ range index $currentNode.Params (printf "has_%s" (index ($graphOptions.Get "has") 1) )}}
|
||||
{{ with $.GetPage (printf "%s%s" (printf "/%s/" (index ($graphOptions.Get "has") 0)) . ) }}
|
||||
<div class="{{ index $.Site.Data.sandpointsnamegraph (index ($graphOptions.Get "has") 0) "depth" }}">
|
||||
{{ range index $currentNode.Params (printf "has_%s" (index ($.Scratch.Get "has") 1) )}}
|
||||
{{ with $.GetPage (printf "%s%s" (printf "/%s/" (index ($.Scratch.Get "has") 0)) . ) }}
|
||||
<div class="{{ index $.Site.Data.sandpointsnamegraph (index ($.Scratch.Get "has") 0) "depth" }}">
|
||||
<a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq ($graphOptions.Get "depth") "crust" }}
|
||||
{{ if eq ($.Scratch.Get "depth") "crust" }}
|
||||
<div class="has">
|
||||
<span class="sup">in {{ index ($graphOptions.Get "in") 1 }}⁄</span>
|
||||
<span class="sup">in {{ index ($.Scratch.Get "in") 1 }}⁄</span>
|
||||
</div>
|
||||
{{ range where $.Site.RegularPages ".Section" (index ($graphOptions.Get "in") 0) }}
|
||||
{{ if in (index .Params (printf "has_%s" ($graphOptions.Get "plural"))) $currentNode.File.LogicalName }}
|
||||
<div class="afterhas">
|
||||
{{ range where $.Site.RegularPages ".Section" (index ($.Scratch.Get "in") 0) }}
|
||||
{{ if in (index .Params (printf "has_%s" ($.Scratch.Get "plural"))) $currentNode.File.LogicalName }}
|
||||
<div class="{{ substr .File.Dir 0 -1 }}">
|
||||
<a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
|
||||
</div>
|
||||
|
|
|
@ -1,44 +1,36 @@
|
|||
{{ $currentSession := . }}
|
||||
|
||||
{{ $_ := newScratch }}
|
||||
{{- range $k, $v := .Page.Site.Data.sandpointsnamegraph -}}
|
||||
{{ if eq $currentSession.File.Dir (printf "%s/" $k) }}
|
||||
{{ $_.Add "depth" (index $v "depth") }}
|
||||
{{ $.Scratch.Add "depth" (index $v "depth") }}
|
||||
{{ if eq (index $v "depth") "mantle" }}
|
||||
{{ $_.Add "home" (index $v "in" 0) }}
|
||||
{{ $.Scratch.Add "home" (index $v "in" 0) }}
|
||||
{{ end }}
|
||||
{{ if eq (index $v "depth") "crust" }}
|
||||
{{ $_.Add "home" (index (index $currentSession.Site.Data.sandpointsnamegraph (index $v "in" 0)) "in" 0) }}
|
||||
{{ $_.Add "mantle" (index $v "in" 0) }}
|
||||
{{ $_.Add "mantle_has" (index (index $currentSession.Site.Data.sandpointsnamegraph (index $v "in" 0)) "has" 1) }}
|
||||
{{ $.Scratch.Add "home" (index (index $currentSession.Site.Data.sandpointsnamegraph (index $v "in" 0)) "in" 0) }}
|
||||
{{ $.Scratch.Add "mantle" (index $v "in" 0) }}
|
||||
{{ $.Scratch.Add "mantle_has" (index (index $currentSession.Site.Data.sandpointsnamegraph (index $v "in" 0)) "has" 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<div class="header">
|
||||
<a title="{{ $.Site.Home.Title }}'s Bibliotheke" href="/library/BROWSE_LIBRARY.html" class="bibliotheke" target="_blank">
|
||||
<img src="/images/bibliotheke.svg" />
|
||||
</a>
|
||||
<div class="breadcrumbs">
|
||||
{{ if ne ($_.Get "depth") "core" }}
|
||||
<a href="{{ with $currentSession.Site.GetPage (printf "/%s/index.md" ($_.Get "home")) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ with $currentSession.Site.GetPage (printf "/%s/index.md" ($_.Get "home")) }}{{ substr .Title 0 1 }}</span><i>{{ substr .Title 1 }}</i></a>{{ end }}
|
||||
{{ if ne ($.Scratch.Get "depth") "core" }}
|
||||
<a href="{{ with $currentSession.Site.GetPage (printf "/%s/index.md" ($.Scratch.Get "home")) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ with $currentSession.Site.GetPage (printf "/%s/index.md" ($.Scratch.Get "home")) }}{{ substr .Title 0 1 }}</span><i>{{ substr .Title 1 }}</i></a>{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq ($_.Get "depth") "mantle" }}
|
||||
{{ if eq ($.Scratch.Get "depth") "mantle" }}
|
||||
<span class="mantlebar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
|
||||
{{ end }}
|
||||
|
||||
{{ if eq ($_.Get "depth") "crust" }}
|
||||
{{ $.Scratch.Set "counter" 0 }}
|
||||
{{ range where $.Site.RegularPages ".Section" ($_.Get "mantle") }}
|
||||
{{ if in (index .Params (printf "has_%s" ($_.Get "mantle_has"))) $currentSession.File.LogicalName }}
|
||||
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
|
||||
{{ if lt ($.Scratch.Get "counter") 2 }}
|
||||
<span><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if eq ($.Scratch.Get "depth") "crust" }}
|
||||
{{ range first 1 (where (where $.Site.RegularPages ".Section" ($.Scratch.Get "mantle")) ".Params.has_sessions" "intersect" (slice $currentSession.File.LogicalName)) }}
|
||||
<span><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
|
||||
{{ end }}
|
||||
<span class="mantlebar"><i> » <a href="{{ $currentSession.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ $currentSession.Title }}</a></i></span>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue