Dotawo/_vendor/git.sandpoints.org/Drawwell/SandpointsTheme/layouts/print/single.html

154 lines
5.7 KiB
HTML
Raw Normal View History

2020-12-18 06:02:50 -08:00
{{- define "singlebody" -}}
2021-02-05 15:32:34 -08:00
{{ $cssTemplate := `.css-_rplc_-h2 {
2021-02-09 13:59:47 -08:00
counter-reset: css-_rplc_-h3;
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h3 {
counter-reset: css-_rplc_-h4;
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h4 {
counter-reset: css-_rplc_-h5;
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h5 {
counter-reset: css-_rplc_-h6;
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h2:before {
color: rgba(0, 0, 0, 0.4);
counter-increment: css-_rplc_-h2 1;
content: counter(css-_rplc_-h2) ". ";
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h3:before {
color: rgba(0, 0, 0, 0.4);
counter-increment: css-_rplc_-h3 1;
content: counter(css-_rplc_-h2) "." counter(css-_rplc_-h3) ". ";
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h4:before {
color: rgba(0, 0, 0, 0.4);
counter-increment: css-_rplc_-h4 1;
content: counter(css-_rplc_-h2) "." counter(css-_rplc_-h3) "." counter(css-_rplc_-h4) ". ";
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h5:before {
color: rgba(0, 0, 0, 0.4);
counter-increment: css-_rplc_-h5 1;
content: counter(css-_rplc_-h2) "." counter(css-_rplc_-h3) "." counter(css-_rplc_-h4) "." counter(css-_rplc_-h5) ". ";
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h6:before {
color: rgba(0, 0, 0, 0.4);
counter-increment: css-_rplc_-h6 1;
content: counter(css-_rplc_-h2) "." counter(css-_rplc_-h3) "." counter(css-_rplc_-h4) "." counter(css-_rplc_-h5) "."
2021-02-05 15:32:34 -08:00
counter(css-_rplc_-h6) ". ";
2021-02-09 13:59:47 -08:00
}
2021-02-05 15:32:34 -08:00
2021-02-09 13:59:47 -08:00
.css-_rplc_-h2.nocount:before,
.css-_rplc_-h3.nocount:before,
.css-_rplc_-h4.nocount:before,
.css-_rplc_-h5.nocount:before,
.css-_rplc_-h6.nocount:before {
content: "";
counter-increment: none;
2021-02-05 15:32:34 -08:00
}` }}
{{ $cssOutput := "" }}
{{ $cssHashes := "" }}
2020-12-18 06:02:50 -08:00
{{ $s := partialCached "scratch.html" . }}
{{ $p := $.GetPage .Params.print }}
{{ $scratch := $s.Get (printf "/%s" $p.File) }}
{{ $currentDir := "" }}
{{ with .File }}
{{ $currentDir = .Dir }}
{{ end }}
2021-02-05 15:23:04 -08:00
<div class="print0">{{ partial "printsinglebody.html" $p }}</div>
<div class="content">{{ $p.Content }}</div>
2021-02-05 15:32:34 -08:00
{{ $cssOutput = printf "%s\n%s" $cssOutput (replace $cssTemplate "_rplc_" $p.File.UniqueID) }}
{{ $cssHashes = printf "%s css-%s-h2" $cssHashes $p.File.UniqueID }}
2021-02-05 15:23:04 -08:00
{{ range $scratch.has_children }}
<div class="crustpage">
2021-02-09 13:59:47 -08:00
{{ $addS := 0 }}
{{ with .Params.authors }}
{{ $addS = len . }}
{{ end }}
2021-02-05 15:32:34 -08:00
{{ range $n, $authorFile := .Params.authors }}
{{ $author := $.GetPage (printf "/author/%s" $authorFile) }}
{{ if eq $n 0 }}
2021-02-09 13:59:47 -08:00
<div class="runningAuthors"><span class="sup">author{{ with (gt $addS 1) }}s{{ end }}</span><a href="#ph-{{ $author.File.UniqueID }}">{{ $author.Title }}</a>
2021-02-05 15:32:34 -08:00
{{ else }}
2021-02-09 13:59:47 -08:00
, <a href="#ph-{{ $author.File.UniqueID }}">{{ $author.Title }}</a>
2021-02-05 15:32:34 -08:00
{{ end }}
2021-02-05 15:23:04 -08:00
{{ end }}
2021-02-05 15:32:34 -08:00
{{ with .Params.authors }}</div>{{ end }}
{{ $tit := .Title }}
{{ if gt (len .Title) 54 }}
{{ $tit = printf "%s…" (substr .Title 0 50) }}
{{ end }}
2021-02-09 13:59:47 -08:00
<div class="runningTitle"><span class="sup">{{ index $scratch.crust 0 }}</span><a href="#ph-{{ .File.UniqueID }}">{{ $tit }}</a></div>
2021-02-05 15:23:04 -08:00
{{ partial "printsinglebody.html" . }}
{{ .Content }}
2021-02-05 15:32:34 -08:00
{{ $cssOutput = printf "%s\n%s" $cssOutput (replace $cssTemplate "_rplc_" .File.UniqueID) }}
{{ $cssHashes = printf "%s css-%s-h2" $cssHashes .File.UniqueID }}
2021-02-09 13:59:47 -08:00
{{ $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="#ph-{{ $author.File.UniqueID }}">{{ $author.Title }}</a>
{{ else }}
, <a href="#ph-{{ $author.File.UniqueID }}">{{ $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="#ph-{{ .File.UniqueID }}">{{ $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 }}
2021-02-05 15:23:04 -08:00
{{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }}
<div class="authorpage">
2021-02-09 13:59:47 -08:00
<div class="runningTitle runningAuthors"><span class="sup">{{ index $scratch.mantle 0 }}</span><a href="#ph-{{ $p.File.UniqueID }}">{{ $p.Title }}</a></div>
<div id="ph-{{ .File.UniqueID }}" class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr .File.Dir 0 -1 }}</span>{{ .Title }}</div>
2021-02-05 15:23:04 -08:00
{{ .Content }}
{{ if in .Page.Site.Params.sandpointsMentionedIn (substr .File.Dir 0 -1) }}
{{ $ss := $s.Get (printf "/%s" .File) }}
<div class="has hasmentionedin">
{{ with $ss }}
<div class="hassup">mentioned in</div>
{{ end }}
<div class="afterhas">
{{ range $ss.backlinks }}
<div class="{{ $ss.child_depth }}">
2021-02-09 13:59:47 -08:00
<a href="#ph-{{ .File.UniqueID }}">{{ .Title }}</a>
2021-02-05 15:23:04 -08:00
</div>
{{ end }}
</div></div>
{{ end }}
{{ end }}
2021-02-05 15:32:34 -08:00
{{ $cssOutput = printf "body {counter-reset: %s;}\n%s" $cssHashes $cssOutput }}
{{ $var := $cssOutput | resources.FromString "css/dyn.css" }}
{{ $dummy := $var.Permalink }}
2020-12-18 06:02:50 -08:00
{{- end -}}