github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/nested-article.hugo (about)

     1  {{- $page := .page }}
     2  {{- $outputFormat := .outputFormat }}
     3  {{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
     4  {{- with $page }}
     5    {{- $currentNode := . }}
     6    {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
     7    {{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
     8    {{- if $pages }}
     9            <section>
    10              <h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
    11    {{- end }}
    12    {{- range $pages }}
    13      {{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
    14    {{- end }}
    15    {{- if $pages }}
    16            </section>
    17    {{- end }}
    18  {{- end }}
    19  {{- define "section-tree-print" }}
    20    {{- $currentNode := .currentnode }}
    21    {{- $outputFormat := .outputFormat }}
    22    {{- $currentFileRelPermalink := .currentnode.RelPermalink }}
    23    {{- with .sect }}
    24      {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
    25      {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
    26      {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
    27      {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
    28      {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
    29      {{- if $hidden }}
    30      {{- else }}
    31        {{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
    32        {{- if $pages }}
    33            <section>
    34              <h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
    35        {{- end }}
    36        {{- range $pages }}
    37          {{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
    38        {{- end }}
    39        {{- if $pages }}
    40            </section>
    41        {{- end }}
    42      {{- end }}
    43    {{- end }}
    44  {{- end }}
    45  {{- define "section-print" }}
    46    {{- $currentNode := .currentnode }}
    47    {{- $outputFormat := .outputFormat }}
    48    {{- with .sect }}
    49      {{- $page := . }}
    50      {{- partialCached "nested-content.hugo" (dict "page" $page "outputFormat" $outputFormat) $page.RelPermalink "outputFormat" $outputFormat }}
    51      {{- range $page.Site.Params.relearn.dependencies }}
    52        {{- $has := printf "has%s" .name }}
    53        {{- $nestedhas := printf "nestedHas%s" .name }}
    54        {{- $currentNode.Page.Store.Set $nestedhas (or ($currentNode.Page.Store.Get $nestedhas) ($page.Page.Store.Get $has)) }}
    55        {{- end }}
    56    {{- end }}
    57  {{- end }}