2022-07-09 14:38:28 +00:00
|
|
|
{{- $page := .page }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- $outputFormat := .outputFormat }}
|
|
|
|
{{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- with $page }}
|
|
|
|
{{- $currentNode := . }}
|
|
|
|
{{- $isActive := .IsHome }}
|
|
|
|
{{- $isShortcut := false }}
|
|
|
|
{{- with .Site.Menus.shortcuts }}
|
|
|
|
{{- range sort . "Weight" }}
|
2022-11-01 23:14:19 +00:00
|
|
|
{{- $shortcut := . }}
|
|
|
|
{{- $shortcutPage := $page.Site.GetPage (printf "%s" $shortcut.URL ) }}
|
|
|
|
{{- if and $shortcutPage (eq $shortcutPage.RelPermalink $page.RelPermalink) }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $isShortcut = true }}
|
|
|
|
{{- end }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2023-01-22 21:16:31 +00:00
|
|
|
{{- $pages := .Site.Home.Pages }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
|
|
|
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
|
|
|
{{- if $isShortcut }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- else }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- if $isActive }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
|
|
|
{{- if $pages }}
|
2022-07-09 14:38:28 +00:00
|
|
|
<section>
|
2022-10-07 18:45:14 +00:00
|
|
|
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- 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 }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- else }}
|
|
|
|
{{- range $pages.ByWeight }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- 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 }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- $outputFormat := .outputFormat }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- $isActive := .isActive }}
|
|
|
|
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
|
|
|
|
{{- with .sect }}
|
|
|
|
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
|
|
|
|
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
|
|
|
|
{{- $isActive = or $isSelf $isActive }}
|
|
|
|
{{- $pages := .Pages }}
|
|
|
|
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
|
|
|
|
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
|
|
|
|
{{- if $hidden }}
|
2022-11-12 19:58:43 +00:00
|
|
|
{{- else }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
|
|
|
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
|
|
|
|
{{- if $isActive }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- if $pages }}
|
|
|
|
<section>
|
2022-10-07 18:45:14 +00:00
|
|
|
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if eq $currentOrdersectionsby "title" }}
|
|
|
|
{{- range $pages.ByTitle }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- else }}
|
|
|
|
{{- range $pages.ByWeight }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat "isActive" $isActive }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if $isActive }}
|
|
|
|
{{- if $pages }}
|
|
|
|
</section>
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- define "section-print" }}
|
|
|
|
{{- $currentNode := .currentnode }}
|
2022-11-13 09:55:17 +00:00
|
|
|
{{- $outputFormat := .outputFormat }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- with .sect }}
|
2022-07-09 23:25:38 +00:00
|
|
|
{{- $page := . }}
|
2022-11-13 15:36:40 +00:00
|
|
|
{{- partialCached "nested-content.hugo" (dict "page" $page "outputFormat" $outputFormat) $page.RelPermalink "outputFormat" $outputFormat }}
|
2022-07-11 21:52:59 +00:00
|
|
|
{{- $currentNode.Page.Store.Set "nestedHasMathJax" (or ($currentNode.Page.Store.Get "nestedHasMathJax") (.Page.Store.Get "hasMathJax")) }}
|
|
|
|
{{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.Page.Store.Get "hasMermaid")) }}
|
|
|
|
{{- $currentNode.Page.Store.Set "nestedHasSwagger" (or ($currentNode.Page.Store.Get "nestedHasSwagger") (.Page.Store.Get "hasSwagger")) }}
|
2022-07-09 08:37:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|