arrownav: fix for hidden pages #685

two consecutive hidden siblings resulted in wrong next page
This commit is contained in:
Sören Weber 2024-09-15 00:02:38 +02:00
parent d3f9f87ed5
commit 415d3a4c60
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -52,13 +52,24 @@
{{- $parent := . }}
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }}
{{- $nextVisible := partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $currentNode) }}
{{- if $nextVisible }}
{{- range $pages }}
{{- if not $nextVisible }}
{{- break }}
{{- end }}
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
{{- if $nextSibling }}
{{- break }}
{{- else }}
{{- $nextVisible = partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $nextVisible) }}
{{- end }}
{{- end }}
{{- if not $nextSibling }}
{{- if $nextVisible }}
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
{{- end }}
{{- if not $nextSibling }}
{{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }}
{{- end }}
{{- else }}
{{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }}
{{- end }}
{{- end }}
{{- return $nextSibling }}