in SpectreOfReflections don't print highlights twice and added longest

title for the has_ menu...
This commit is contained in:
Marcell Mars 2021-09-09 12:16:58 +02:00
parent 6ea77e8efa
commit 5a361dcc16
3 changed files with 75 additions and 56 deletions

View file

@ -74,56 +74,68 @@
{{ range $scratch.has_children }}
<div class="crustpage">
{{ $addS := 0 }}
{{ with .Params.editors }}
{{ $addS = len . }}
{{ end }}
{{ range $n, $authorFile := .Params.editors }}
{{ $author := $.GetPage (printf "/editor/%s" $authorFile) }}
{{ if eq $n 0 }}
<div class="runningAuthors"><span class="sup">editor{{ 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>
{{ if not (.Scratch.Get "alreadyRendered") }}
{{ $addS := 0 }}
{{ with .Params.editors }}
{{ $addS = len . }}
{{ end }}
{{ end }}
{{ with .Params.editors }}</div>{{ end }}
{{ range $n, $authorFile := .Params.editors }}
{{ $author := $.GetPage (printf "/editor/%s" $authorFile) }}
{{ if eq $n 0 }}
<div class="runningAuthors"><span class="sup">editor{{ 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.editors }}</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 }}
{{ $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 }}
{{ .Scratch.Set "alreadyRendered" true }}
{{ $cssOutput = printf "%s\n%s" $cssOutput (replace $cssTemplate "_rplc_" .File.UniqueID) }}
{{ $cssHashes = printf "%s css-%s-h2" $cssHashes .File.UniqueID }}
{{end}}
{{ $kid := $s.Get (printf "/%s" .File) }}
{{ range $kid.has_children }}
<div class="crustpage">
{{ $addS := 0 }}
{{ with .Params.editors }}
{{ $addS = len . }}
{{ end }}
{{ range $n, $authorFile := .Params.editors }}
{{ $author := $.GetPage (printf "/editor/%s" $authorFile) }}
{{ if eq $n 0 }}
<div class="runningAuthors"><span class="sup">editor{{ 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>
{{ if not (.Scratch.Get "alreadyRendered") }}
<div class="crustpage">
{{ $addS := 0 }}
{{ with .Params.editors }}
{{ $addS = len . }}
{{ end }}
{{ end }}
{{ with .Params.editors }}</div>{{ end }}
{{ range $n, $authorFile := .Params.editors }}
{{ $author := $.GetPage (printf "/editor/%s" $authorFile) }}
{{ if eq $n 0 }}
<div class="runningAuthors"><span class="sup">editor{{ 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.editors }}</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 }}
{{ $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 }}
{{ $k := $s.Get (printf "/%s" .File) }}
{{ if gt (len $k.is_in) 0 }}
<div class="backlinks"><span class="supt">is in</span>{{- range $i, $v := $k.is_in -}}{{ if ne $i 0 }}, {{ end }}<a href="#ph-{{ .File.UniqueID }}">{{ .Title }}</a>{{- end -}}</div>
{{ end }}
{{ .Scratch.Set "alreadyRendered" true }}
{{ $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") }}
@ -134,19 +146,12 @@
{{ 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 }}">
<a href="#ph-{{ .File.UniqueID }}">{{ .Title }}</a>
</div>
{{ end }}
</div></div>
{{ with $ss }}
<div class="backlinks"><span class="supt">mentioned in</span>{{- range $i, $v := $ss.backlinks -}}{{ if ne $i 0 }}, {{ end }}<a href="#ph-{{ .File.UniqueID }}">{{ .Title }}</a>{{- end -}}</div>
{{ end }}
{{ end }}
{{ end }}
{{ $cssOutput = printf "body {counter-reset: %s;}\n%s" $cssHashes $cssOutput }}
{{ $var := $cssOutput | resources.FromString "css/dyn.css" }}
{{ $dummy := $var.Permalink }}

View file

@ -8,6 +8,8 @@
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}
{{ $longestTitle := "" }}
<div id="ph-{{ .File.UniqueID }}" class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}</span>{{ .Title }}</div>
<div class="grid">
@ -64,7 +66,13 @@
<div class="{{ $scratch.child_depth }} crustoc">
<a class="toc" href="#ph-{{ .File.UniqueID }}"><span><span class="back">{{ .Title }} {{with $authors}}({{ $authors }}){{ end }}</span></span></a>
</div>
{{ if gt (len .Title) (len $longestTitle) }}
{{ $longestTitle = .Title }}
{{ end }}
{{ end }}
<div class="{{ $scratch.child_depth }} crustoc longesttitle">
<a class="toc" href="javascript:;"><span><span class="back">{{ $longestTitle }}.....</span></span></a>
</div>
</div></div>
{{ end }}

View file

@ -200,7 +200,8 @@
bottom: 0
}
.crustoc::after {
a.toc::before {
direction: rtl;
content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ";
line-height: 0;
height: 1px;
@ -233,4 +234,9 @@
ol[data-split-from] {
padding-left: 0.5rem;
}
.longesttitle {
visibility: hidden;
cursor: default;
}
}