{{- $page := .page }} {{- $page.Page.Store.Set (printf "%sIsNested" (($page.Scratch.Get "relearnOutputFormat") | lower)) true }} {{- with $page }} {{- $currentNode := . }} {{- $isActive := .IsHome }} {{- $isShortcut := false }} {{- $r_url := .RelPermalink }} {{- with .Site.Menus.shortcuts }} {{- range sort . "Weight" }} {{- $s_url := .URL | relLangURL }} {{- if (eq $s_url $r_url) }} {{- $isShortcut = true }} {{- end }} {{- end }} {{- end }} {{- $pages := .Site.Home.Sections }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }} {{- if $isShortcut }} {{- template "section-print" dict "sect" . "currentnode" $currentNode }} {{- else }} {{- if $isActive }} {{- template "section-print" dict "sect" . "currentnode" $currentNode }} {{- if or $pages }}
{{- end }} {{- end }} {{- if eq $currentOrdersectionsby "title" }} {{- range $pages.ByTitle }} {{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }} {{- end }} {{- else }} {{- range $pages.ByWeight }} {{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }} {{- end }} {{- end }} {{- if $isActive }} {{- if $pages }}
{{- end }} {{- end }} {{- end }} {{- end }} {{- define "section-tree-print" }} {{- $currentNode := .currentnode }} {{- $isActive := .isActive }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- with .sect }} {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $isActive = or $isSelf $isActive }} {{- $pages := .Pages }} {{- if .Page.IsHome }} {{- $pages = .Sections }} {{- else if .Page.Sections}} {{- $pages = (.Pages | union .Sections) }} {{- end }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} {{- else if or .IsSection .IsHome }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} {{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }} {{- if $isActive }} {{- template "section-print" dict "sect" . "currentnode" $currentNode }} {{- if $pages }}
{{- end }} {{- end }} {{- if eq $currentOrdersectionsby "title" }} {{- range $pages.ByTitle }} {{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }} {{- end }} {{- else }} {{- range $pages.ByWeight }} {{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }} {{- end }} {{- end }} {{- if $isActive }} {{- if $pages }}
{{- end }} {{- end }} {{- else }} {{- if $isActive }} {{- template "section-print" dict "sect" . "currentnode" $currentNode }} {{- end }} {{- end }} {{- end }} {{- end }} {{- define "section-print" }} {{- $currentNode := .currentnode }} {{- with .sect }} {{- $page := . }} {{- $content := partial "content.html" $page }} {{- partial "output-partial.html" (dict "base" "output-article" "page" $page "parameter" (dict "page" $page "content" $content)) }} {{- range $page.OutputFormats }} {{- $currentNode.Scratch.Set (printf "%sHasMathJax" (.Name | lower)) (or ($currentNode.Scratch.Get (printf "%sHasMathJax" (.Name | lower))) ($page.Scratch.Get (printf "%sHasMathJax" (.Name | lower)))) }} {{- $currentNode.Scratch.Set (printf "%sHasMermaid" (.Name | lower)) (or ($currentNode.Scratch.Get (printf "%sHasMermaid" (.Name | lower))) ($page.Scratch.Get (printf "%sHasMermaid" (.Name | lower)))) }} {{- $currentNode.Scratch.Set (printf "%sHasSwagger" (.Name | lower)) (or ($currentNode.Scratch.Get (printf "%sHasSwagger" (.Name | lower))) ($page.Scratch.Get (printf "%sHasSwagger" (.Name | lower)))) }} {{- end }} {{- end }} {{- end }}