if print root is core render recursively down to crust

This commit is contained in:
Marcell Mars 2021-02-08 03:21:20 +01:00
parent 2c21080f41
commit 614a9a9e09
2 changed files with 76 additions and 46 deletions

View file

@ -62,7 +62,7 @@
{{ $authors = printf "%s%s" $prefix $authorPage.Title }} {{ $authors = printf "%s%s" $prefix $authorPage.Title }}
{{ end }} {{ end }}
<div class="{{ $scratch.child_depth }} crustoc"> <div class="{{ $scratch.child_depth }} crustoc">
<a class="toc" href="#{{ .File.LogicalName }}"><span><span class="back">{{ .Title }} ({{ $authors }})</span></span></a> <a class="toc" href="#{{ .File.LogicalName }}"><span><span class="back">{{ .Title }} {{with $authors}}({{ $authors }}){{ end }}</span></span></a>
</div> </div>
{{ end }} {{ end }}
</div></div> </div></div>

View file

@ -74,7 +74,10 @@
{{ range $scratch.has_children }} {{ range $scratch.has_children }}
<div class="crustpage"> <div class="crustpage">
{{ $addS := len .Params.authors }} {{ $addS := 0 }}
{{ with .Params.authors }}
{{ $addS = len . }}
{{ end }}
{{ range $n, $authorFile := .Params.authors }} {{ range $n, $authorFile := .Params.authors }}
{{ $author := $.GetPage (printf "/author/%s" $authorFile) }} {{ $author := $.GetPage (printf "/author/%s" $authorFile) }}
{{ if eq $n 0 }} {{ if eq $n 0 }}
@ -94,6 +97,33 @@
{{ .Content }} {{ .Content }}
{{ $cssOutput = printf "%s\n%s" $cssOutput (replace $cssTemplate "_rplc_" .File.UniqueID) }} {{ $cssOutput = printf "%s\n%s" $cssOutput (replace $cssTemplate "_rplc_" .File.UniqueID) }}
{{ $cssHashes = printf "%s css-%s-h2" $cssHashes .File.UniqueID }} {{ $cssHashes = printf "%s css-%s-h2" $cssHashes .File.UniqueID }}
{{ $kid := $s.Get (printf "/%s" .File) }}
{{ range $kid.has_children }}
<div class="crustpage">
{{ $addS := 0 }}
{{ with .Params.authors }}
{{ $addS = len . }}
{{ end }}
{{ range $n, $authorFile := .Params.authors }}
{{ $author := $.GetPage (printf "/author/%s" $authorFile) }}
{{ if eq $n 0 }}
<div class="runningAuthors"><span class="sup">author{{ with (gt $addS 1) }}s{{ end }}</span><a href="#{{ $author.File.LogicalName }}">{{ $author.Title }}</a>
{{ else }}
, <a href="#{{ $author.File.LogicalName }}">{{ $author.Title }}</a>
{{ end }}
{{ end }}
{{ with .Params.authors }}</div>{{ end }}
{{ $tit := .Title }}
{{ if gt (len .Title) 54 }}
{{ $tit = printf "%s…" (substr .Title 0 50) }}
{{ end }}
<div class="runningTitle"><span class="sup">{{ index $scratch.crust 0 }}</span><a href="#{{ .File.LogicalName }}">{{ $tit }}</a></div>
{{ partial "printsinglebody.html" . }}
{{ .Content }}
{{ $cssOutput = printf "%s\n%s" $cssOutput (replace $cssTemplate "_rplc_" .File.UniqueID) }}
{{ $cssHashes = printf "%s css-%s-h2" $cssHashes .File.UniqueID }}
{{ end }}
{{ end }} {{ end }}
{{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }} {{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }}