From 5a361dcc1676b161875525641ac366dec2ed16ba Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Thu, 9 Sep 2021 12:16:58 +0200 Subject: [PATCH] in SpectreOfReflections don't print highlights twice and added longest title for the has_ menu... --- .../layouts/print/single.html | 115 +++++++++--------- layouts/partials/printsinglebody.html | 8 ++ static/css/print.css | 8 +- 3 files changed, 75 insertions(+), 56 deletions(-) diff --git a/customizations/SpectreOfReflections/layouts/print/single.html b/customizations/SpectreOfReflections/layouts/print/single.html index 3e4d39d..1caf919 100644 --- a/customizations/SpectreOfReflections/layouts/print/single.html +++ b/customizations/SpectreOfReflections/layouts/print/single.html @@ -74,56 +74,68 @@ {{ range $scratch.has_children }}
- {{ $addS := 0 }} - {{ with .Params.editors }} - {{ $addS = len . }} - {{ end }} - {{ range $n, $authorFile := .Params.editors }} - {{ $author := $.GetPage (printf "/editor/%s" $authorFile) }} - {{ if eq $n 0 }} -
editor{{ with (gt $addS 1) }}s{{ end }}⁄{{ $author.Title }} - {{ else }} - , {{ $author.Title }} + {{ if not (.Scratch.Get "alreadyRendered") }} + {{ $addS := 0 }} + {{ with .Params.editors }} + {{ $addS = len . }} {{ end }} - {{ end }} - {{ with .Params.editors }}
{{ end }} + {{ range $n, $authorFile := .Params.editors }} + {{ $author := $.GetPage (printf "/editor/%s" $authorFile) }} + {{ if eq $n 0 }} +
editor{{ with (gt $addS 1) }}s{{ end }}⁄{{ $author.Title }} + {{ else }} + , {{ $author.Title }} + {{ end }} + {{ end }} + {{ with .Params.editors }}
{{ end }} - {{ $tit := .Title }} - {{ if gt (len .Title) 54 }} - {{ $tit = printf "%s…" (substr .Title 0 50) }} - {{ end }} -
{{ index $scratch.crust 0 }}⁄{{ $tit }}
- {{ 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 }} +
{{ index $scratch.crust 0 }}⁄{{ $tit }}
+ {{ 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 }} -
- {{ $addS := 0 }} - {{ with .Params.editors }} - {{ $addS = len . }} - {{ end }} - {{ range $n, $authorFile := .Params.editors }} - {{ $author := $.GetPage (printf "/editor/%s" $authorFile) }} - {{ if eq $n 0 }} -
editor{{ with (gt $addS 1) }}s{{ end }}⁄{{ $author.Title }} - {{ else }} - , {{ $author.Title }} + {{ if not (.Scratch.Get "alreadyRendered") }} +
+ {{ $addS := 0 }} + {{ with .Params.editors }} + {{ $addS = len . }} {{ end }} - {{ end }} - {{ with .Params.editors }}
{{ end }} + {{ range $n, $authorFile := .Params.editors }} + {{ $author := $.GetPage (printf "/editor/%s" $authorFile) }} + {{ if eq $n 0 }} +
editor{{ with (gt $addS 1) }}s{{ end }}⁄{{ $author.Title }} + {{ else }} + , {{ $author.Title }} + {{ end }} + {{ end }} + {{ with .Params.editors }}
{{ end }} - {{ $tit := .Title }} - {{ if gt (len .Title) 54 }} - {{ $tit = printf "%s…" (substr .Title 0 50) }} - {{ end }} -
{{ index $scratch.crust 0 }}⁄{{ $tit }}
- {{ 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 }} +
{{ index $scratch.crust 0 }}⁄{{ $tit }}
+ {{ partial "printsinglebody.html" . }} + {{ .Content }} + {{ $k := $s.Get (printf "/%s" .File) }} + {{ if gt (len $k.is_in) 0 }} + + {{ 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) }} -
- {{ with $ss }} -
mentioned in⁄
- {{ end }} -
- {{ range $ss.backlinks }} - - {{ end }} -
+ {{ with $ss }} + + {{ end }} {{ end }} {{ end }} + {{ $cssOutput = printf "body {counter-reset: %s;}\n%s" $cssHashes $cssOutput }} {{ $var := $cssOutput | resources.FromString "css/dyn.css" }} {{ $dummy := $var.Permalink }} diff --git a/layouts/partials/printsinglebody.html b/layouts/partials/printsinglebody.html index 977f14b..676d824 100644 --- a/layouts/partials/printsinglebody.html +++ b/layouts/partials/printsinglebody.html @@ -8,6 +8,8 @@ {{ $currentFile := (printf "/%s" .File) }} {{ $scratch := $s.Get $currentFile }} +{{ $longestTitle := "" }} +
{{ substr $currentDir 0 -1 }}⁄{{ .Title }}
@@ -64,7 +66,13 @@ + {{ if gt (len .Title) (len $longestTitle) }} + {{ $longestTitle = .Title }} + {{ end }} {{ end }} +
{{ end }} diff --git a/static/css/print.css b/static/css/print.css index 8dcf660..4682b5e 100644 --- a/static/css/print.css +++ b/static/css/print.css @@ -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; + } }