backy/docs/themes/hugo-theme-relearn/layouts/partials/nested-article.hugo
Andrew Woodlee 4b382bddd9 v0.3.0
* Getting environment variables and passwords from Vault (not tested
yet)
* Vault configuration to config (not tested yet)
* Ability to run scripts from file on local machine on the remote host
* Ability to get ouput in the notification of a list for individual
commands or all commands
* Make SSH connections close after all commands have been run; reuse
previous connections if needed
2023-07-01 21:46:54 -05:00

72 lines
3.3 KiB
Plaintext

{{- $page := .page }}
{{- $outputFormat := .outputFormat }}
{{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
{{- with $page }}
{{- $currentNode := . }}
{{- $pages := .Pages }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
<section>
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
{{- end }}
{{- if eq $currentOrdersectionsby "title" }}
{{- range $pages.ByTitle }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- else }}
{{- range $pages.ByWeight }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- end }}
{{- if $pages }}
</section>
{{- end }}
{{- end }}
{{- define "section-tree-print" }}
{{- $currentNode := .currentnode }}
{{- $outputFormat := .outputFormat }}
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- with .sect }}
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $pages := .Pages }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }}
{{- else }}
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
{{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
<section>
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
{{- end }}
{{- if eq $currentOrdersectionsby "title" }}
{{- range $pages.ByTitle }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- else }}
{{- range $pages.ByWeight }}
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- end }}
{{- end }}
{{- if $pages }}
</section>
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- define "section-print" }}
{{- $currentNode := .currentnode }}
{{- $outputFormat := .outputFormat }}
{{- with .sect }}
{{- $page := . }}
{{- partialCached "nested-content.hugo" (dict "page" $page "outputFormat" $outputFormat) $page.RelPermalink "outputFormat" $outputFormat }}
{{- $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 "nestedHasOpenapi" (or ($currentNode.Page.Store.Get "nestedHasOpenapi") (.Page.Store.Get "hasOpenapi")) }}
{{- end }}
{{- end }}