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,6 +74,7 @@
{{ range $scratch.has_children }} {{ range $scratch.has_children }}
<div class="crustpage"> <div class="crustpage">
{{ if not (.Scratch.Get "alreadyRendered") }}
{{ $addS := 0 }} {{ $addS := 0 }}
{{ with .Params.editors }} {{ with .Params.editors }}
{{ $addS = len . }} {{ $addS = len . }}
@ -95,10 +96,14 @@
<div class="runningTitle"><span class="sup">{{ index $scratch.crust 0 }}</span><a href="#ph-{{ .File.UniqueID }}">{{ $tit }}</a></div> <div class="runningTitle"><span class="sup">{{ index $scratch.crust 0 }}</span><a href="#ph-{{ .File.UniqueID }}">{{ $tit }}</a></div>
{{ partial "printsinglebody.html" . }} {{ partial "printsinglebody.html" . }}
{{ .Content }} {{ .Content }}
{{ .Scratch.Set "alreadyRendered" true }}
{{ $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 }}
{{end}}
{{ $kid := $s.Get (printf "/%s" .File) }} {{ $kid := $s.Get (printf "/%s" .File) }}
{{ range $kid.has_children }} {{ range $kid.has_children }}
{{ if not (.Scratch.Get "alreadyRendered") }}
<div class="crustpage"> <div class="crustpage">
{{ $addS := 0 }} {{ $addS := 0 }}
{{ with .Params.editors }} {{ with .Params.editors }}
@ -121,10 +126,17 @@
<div class="runningTitle"><span class="sup">{{ index $scratch.crust 0 }}</span><a href="#ph-{{ .File.UniqueID }}">{{ $tit }}</a></div> <div class="runningTitle"><span class="sup">{{ index $scratch.crust 0 }}</span><a href="#ph-{{ .File.UniqueID }}">{{ $tit }}</a></div>
{{ partial "printsinglebody.html" . }} {{ partial "printsinglebody.html" . }}
{{ .Content }} {{ .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) }} {{ $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 }}
{{ end }} {{ end }}
{{end}} {{end}}
{{ end }}
{{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }} {{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }}
<div class="authorpage"> <div class="authorpage">
@ -134,19 +146,12 @@
{{ if in .Page.Site.Params.sandpointsMentionedIn (substr .File.Dir 0 -1) }} {{ if in .Page.Site.Params.sandpointsMentionedIn (substr .File.Dir 0 -1) }}
{{ $ss := $s.Get (printf "/%s" .File) }} {{ $ss := $s.Get (printf "/%s" .File) }}
<div class="has hasmentionedin">
{{ with $ss }} {{ with $ss }}
<div class="hassup">mentioned in</div> <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 }}
<div class="afterhas">
{{ range $ss.backlinks }}
<div class="{{ $ss.child_depth }}">
<a href="#ph-{{ .File.UniqueID }}">{{ .Title }}</a>
</div>
{{ end }}
</div></div>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ $cssOutput = printf "body {counter-reset: %s;}\n%s" $cssHashes $cssOutput }} {{ $cssOutput = printf "body {counter-reset: %s;}\n%s" $cssHashes $cssOutput }}
{{ $var := $cssOutput | resources.FromString "css/dyn.css" }} {{ $var := $cssOutput | resources.FromString "css/dyn.css" }}
{{ $dummy := $var.Permalink }} {{ $dummy := $var.Permalink }}

View file

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

View file

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