{{ define "recurse-toc" }} {{ $s := .section }} {{ $psid := .psid }} {{ $pages := (union $s.Pages $s.Sections).ByWeight }} {{ $subSection := 1 }} {{ range where $pages ".Params.no_print" "!=" true }} {{ $sid := printf "%s%d" $psid $subSection }} {{ $subSection = add $subSection 1 }} {{ partial "print/toc-li.html" (dict "sid" $sid "Page" .) }} {{ if .IsSection }} {{ end }} {{ end }} {{ end }} {{ define "recurse-content" }} {{ $s := .section }} {{ $psid := .psid }} {{ $pages := (union $s.Pages $s.Sections).ByWeight }} {{ $subSection := 1 }} {{ $breakOnWordCount := default 50 ($s.Site.Param "print.section_break_wordcount") }} {{ $doPageBreak := gt (countwords $s.Content) $breakOnWordCount }} {{ range where $pages ".Params.no_print" "!=" true }} {{ $sid := printf "%s%d" $psid $subSection }} {{ $subSection = add $subSection 1 }} {{ $params := dict "Page" . "PageNum" $sid "DoPageBreak" $doPageBreak }} {{ partial "print/content.html" $params }} {{ if .IsSection }} {{ template "recurse-content" (dict "section" . "psid" (printf "%s." $sid) ) }} {{ end }} {{ $doPageBreak = true }} {{ end }} {{ end }}

{{ T "print_printable_section" }} {{ T "print_click_to_print" }}.

{{ T "print_show_regular" }}.

{{ partial "print/page-heading.html" . }} {{ if not (.Param "print.disable_toc") }} {{ end }}
{{ .Content }}
{{ template "recurse-content" (dict "section" .CurrentSection "psid" "") }}