theme: simplify pagesBy #685

This commit is contained in:
Sören Weber 2024-07-21 21:49:53 +02:00
parent 1b2e139512
commit fe9d605d57
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
5 changed files with 7 additions and 17 deletions

View file

@ -31,7 +31,7 @@
<div id="R-content-wrapper" class="highlightable">
<div id="R-topics">
<ul class="enlarge morespace collapsible-menu">
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .Site.Home "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .Site.Home) }}
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
{{- range $pages }}
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
@ -130,7 +130,7 @@
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $isActive := $isSelf }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }}

View file

@ -3,7 +3,7 @@
{{- $page.Page.Store.Set (printf "%sIsNested" $outputFormat) true }}
{{- with $page }}
{{- $currentNode := . }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }}
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
{{- if $pages }}
<section>
@ -23,7 +23,7 @@
{{- with .sect }}
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
{{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
{{- if $hidden }}

View file

@ -50,7 +50,7 @@
{{- end }}
{{- end }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node) }}
{{- range $pages }}
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current }}
{{- end }}

View file

@ -32,14 +32,4 @@
{{- $pages = $page.Pages }}
{{- end }}
{{- if not $hidden }}
{{- $nonhiddenpages := slice }}
{{- range $page := $pages }}
{{- if not (partial "pageHelper/isHidden.html" $page) }}
{{- $nonhiddenpages := $nonhiddenpages | append $page }}
{{- end }}
{{- end }}
{{- $pages = $nonhiddenpages }}
{{- end }}
{{- return $pages }}

View file

@ -21,7 +21,7 @@
{{- with $page }}
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }}
{{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }}
{{ (printf "</%s>" $containerstyle)|safeHTML }}
{{- end }}
@ -66,7 +66,7 @@
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
{{- end }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }}
{{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }}
{{- if eq $.style "li" }}