2021-09-09 20:26:24 +00:00
|
|
|
{{- $currentNode := . }}
|
2021-11-15 22:41:51 +00:00
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsSelfFound" }}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnPrevPage" }}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnNextPage" }}
|
2022-04-03 10:12:12 +00:00
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}{{/* the node itself is flagged as hidden */}}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenStem" }}{{/* the node or one of its parents is flagged as hidden */}}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}}
|
2022-07-11 21:52:59 +00:00
|
|
|
{{- $currentNode.Scratch.Delete (printf "%sWantsMathJax" ((partial "output-format.html" $currentNode) | lower)) }}
|
|
|
|
{{- $wantsMathjax := or (and (ne $currentNode.Params.disableMathjax nil) (not $currentNode.Params.disableMathjax)) (and (ne .Site.Params.disableMathjax nil) (not .Site.Params.disableMathjax)) }}
|
|
|
|
{{- if $wantsMathjax }}
|
|
|
|
{{- $currentNode.Store.Set "hasMathJax" true }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $wantsMermaid := or (and (ne $currentNode.Params.disableMermaid nil) (not $currentNode.Params.disableMermaid)) (and (ne .Site.Params.disableMermaid nil) (not .Site.Params.disableMermaid)) }}
|
|
|
|
{{- if $wantsMermaid }}
|
|
|
|
{{- $currentNode.Store.Set "hasMermaid" true }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $wantsSwagger := or (and (ne $currentNode.Params.disableSwagger nil) (not $currentNode.Params.disableSwagger)) (and (ne .Site.Params.disableSwagger nil) (not .Site.Params.disableSwagger)) }}
|
|
|
|
{{- if $wantsSwagger }}
|
|
|
|
{{- $currentNode.Store.Set "hasSwagger" true }}
|
2022-07-09 23:25:38 +00:00
|
|
|
{{- end }}
|
2022-02-07 21:24:57 +00:00
|
|
|
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false "defaultOrdersectionsby" .Site.Params.ordersectionsby }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- define "relearn-structure" }}
|
|
|
|
{{- $currentNode := .currentnode }}
|
|
|
|
{{- $isSelf := eq $currentNode.RelPermalink .node.RelPermalink }}
|
|
|
|
{{- $isDescendant := and (not $isSelf) (.node.IsDescendant $currentNode) }}
|
|
|
|
{{- $isAncestor := and (not $isSelf) (.node.IsAncestor $currentNode) }}
|
|
|
|
{{- $isOther := and (not $isDescendant) (not $isSelf) (not $isAncestor) }}
|
|
|
|
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $isChildren := and (.node.Parent) (eq $currentNode.RelPermalink .node.Parent.RelPermalink) }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- if $isSelf }}
|
|
|
|
{{- $currentNode.Scratch.Set "relearnIsSelfFound" true }}
|
|
|
|
{{- end}}
|
|
|
|
{{- $isSelfFound := eq ($currentNode.Scratch.Get "relearnIsSelfFound") true }}
|
|
|
|
{{- $isPreSelf := and (not $isSelfFound) (not $isSelf) }}
|
|
|
|
{{- $isPostSelf := and ($isSelfFound) (not $isSelf) }}
|
|
|
|
|
|
|
|
{{- $hidden_node := or (.node.Params.hidden) (eq .node.Title "") }}
|
|
|
|
{{- $hidden_stem:= or $hidden_node .hiddenstem }}
|
|
|
|
{{- $hidden_current_stem:= or $hidden_node .hiddencurrent }}
|
|
|
|
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hiddencurrent (or $isPreSelf $isPostSelf $isDescendant) ) }}
|
2021-11-22 11:10:35 +00:00
|
|
|
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenNode" .node.RelPermalink $hidden_node }}
|
|
|
|
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenStem" .node.RelPermalink $hidden_stem }}
|
|
|
|
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenFrom" .node.RelPermalink $hidden_current_stem }}
|
2021-09-09 20:26:24 +00:00
|
|
|
|
|
|
|
{{- if not $hidden_from_current }}
|
|
|
|
{{- if $isPreSelf }}
|
|
|
|
{{- $currentNode.Scratch.Set "relearnPrevPage" .node }}
|
|
|
|
{{- else if and $isPostSelf (eq ($currentNode.Scratch.Get "relearnNextPage") nil) }}
|
|
|
|
{{- $currentNode.Scratch.Set "relearnNextPage" .node }}
|
|
|
|
{{- end}}
|
|
|
|
{{- end }}
|
|
|
|
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $pages := .node.Pages }}
|
2021-09-27 19:06:00 +00:00
|
|
|
{{- if .node.IsHome }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $pages = .node.Sections }}
|
2021-09-27 19:06:00 +00:00
|
|
|
{{- else if .node.Sections }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $pages = (.node.Pages | union .node.Sections) }}
|
2021-09-27 19:06:00 +00:00
|
|
|
{{- end }}
|
2022-02-07 21:24:57 +00:00
|
|
|
{{- $defaultOrdersectionsby := .defaultOrdersectionsby }}
|
2021-09-27 20:03:10 +00:00
|
|
|
{{- $currentOrdersectionsby := .node.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
|
|
|
{{- if eq $currentOrdersectionsby "title"}}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $pages := $pages.ByTitle }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- else}}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $pages := $pages.ByWeight }}
|
|
|
|
{{- end }}
|
|
|
|
{{- range $pages }}
|
|
|
|
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current "defaultOrdersectionsby" $defaultOrdersectionsby }}
|
|
|
|
{{- end}}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- end }}
|