github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/themes/docsy/layouts/partials/print/render.html (about) 1 {{ define "recurse-toc" }} 2 {{ $s := .section }} 3 {{ $psid := .psid }} 4 {{ $pages := (union $s.Pages $s.Sections).ByWeight }} 5 {{ $subSection := 1 }} 6 7 {{ range where $pages ".Params.no_print" "!=" true }} 8 {{ $sid := printf "%s%d" $psid $subSection }} 9 {{ $subSection = add $subSection 1 }} 10 {{ partial "print/toc-li.html" (dict "sid" $sid "Page" .) }} 11 {{ if .IsSection }} 12 <ul> 13 {{ template "recurse-toc" (dict "section" . "psid" (printf "%s." $sid)) }} 14 </ul> 15 {{ end }} 16 {{ end }} 17 {{ end }} 18 19 {{ define "recurse-content" }} 20 {{ $s := .section }} 21 {{ $psid := .psid }} 22 {{ $pages := (union $s.Pages $s.Sections).ByWeight }} 23 {{ $subSection := 1 }} 24 25 {{ $breakOnWordCount := default 50 ($s.Site.Param "print.section_break_wordcount") }} 26 {{ $doPageBreak := gt (countwords $s.Content) $breakOnWordCount }} 27 28 {{ range where $pages ".Params.no_print" "!=" true }} 29 {{ $sid := printf "%s%d" $psid $subSection }} 30 {{ $subSection = add $subSection 1 }} 31 {{ $params := dict "Page" . "PageNum" $sid "DoPageBreak" $doPageBreak }} 32 {{ partial "print/content.html" $params }} 33 34 {{ if .IsSection }} 35 {{ template "recurse-content" (dict "section" . "psid" (printf "%s." $sid) ) }} 36 {{ end }} 37 {{ $doPageBreak = true }} 38 {{ end }} 39 {{ end }} 40 41 <div class="td-content"> 42 <div class="pageinfo pageinfo-primary d-print-none"> 43 <p> 44 {{ T "print_printable_section" }} 45 <a href="#" onclick="print();return false;">{{ T "print_click_to_print" }}</a>. 46 </p><p> 47 <a href="{{ .RelPermalink }}">{{ T "print_show_regular" }}</a>. 48 </p> 49 </div> 50 {{ partial "print/page-heading.html" . }} 51 52 {{ if not (.Param "print.disable_toc") }} 53 <ul> 54 {{ template "recurse-toc" (dict "section" .CurrentSection "psid" "") }} 55 </ul> 56 {{ end }} 57 58 <div class="content"> 59 {{ .Content }} 60 </div> 61 </div> 62 63 {{ template "recurse-content" (dict "section" .CurrentSection "psid" "") }}