2022-07-09 14:38:28 +00:00
|
|
|
{{- $page := .page }}
|
2022-07-10 22:59:26 +00:00
|
|
|
{{- $page.Page.Store.Set (printf "%sIsNested" ((partial "output-format.html" $page) | lower)) true }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- 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 }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $pages := .Site.Home.Sections }}
|
|
|
|
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
|
|
|
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
|
|
|
{{- if $isShortcut }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
|
|
|
{{- else }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- if $isActive }}
|
|
|
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
|
|
|
{{- if or $pages }}
|
|
|
|
<section>
|
|
|
|
{{- end }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- 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 }}
|
|
|
|
</section>
|
|
|
|
{{- end }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- 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 }}
|
|
|
|
<section>
|
|
|
|
{{- 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 }}
|
|
|
|
</section>
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- else }}
|
|
|
|
{{- if $isActive }}
|
|
|
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- define "section-print" }}
|
|
|
|
{{- $currentNode := .currentnode }}
|
|
|
|
{{- with .sect }}
|
2022-07-09 23:25:38 +00:00
|
|
|
{{- $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 }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|