Skip to content

Commit

Permalink
spelling out Table of Contents (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
matebarabas authored Jan 28, 2025
1 parent d69e8aa commit 00ff22c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/layouts/partials/topbar/button/toc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- $onempty := cond (isset . "onempty") .onempty "hide" }}
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $defaultDisableToc := .Site.Params.disableToc | default false }}
{{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }}
{{- if not $currentDisableToc }}
{{- $content := partial "toc-class.html" . }}
{{- $hascontent := not (eq 0 (int (len (trim ($content | plainify) "\n\r\t ")))) }}
{{- if not $hascontent }}
{{- $content = " " }}
{{- else }}
{{- $content = (print "\n" $content) | safeHTML }}
{{- end }}
{{- partial "topbar/func/button.html" (dict
"page" .
"class" "topbar-button-toc"
"href" "javascript:toggleTopbarFlyout(this)"
"icon" "list-alt"
"onempty" $onempty
"onwidths" $onwidths
"onwidthm" $onwidthm
"onwidthl" $onwidthl
"hint" (printf "%s (CTRL+ALT+t)" (T "Toc-toggle"))
"content" $content
"title" "Table of Contents"
)}}
{{- end }}
{{- end }}

0 comments on commit 00ff22c

Please sign in to comment.