a big print commit.. made for dotawo.. should work for the rest...

This commit is contained in:
Marcell Mars 2021-02-04 21:50:05 +01:00
parent bfe91a464c
commit b3db1a987f
13 changed files with 1558 additions and 571 deletions

View file

@ -5,9 +5,9 @@ module.exports = {
require('postcss-import')({
path: [themeDir]
}),
require('autoprefixer')({
grid: true
}),
require('postcss-reporter'),
/* require('autoprefixer')({
* grid: true
* }),
* require('postcss-reporter'), */
]
}

View file

@ -147,6 +147,10 @@ body {
color: black;
}
#preview {
display: none;
}
sup,
sub {
vertical-align: baseline;

View file

@ -8,7 +8,9 @@
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}
<div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}</span>{{ .Title }}</div></div>
{{ $sandnamePlural := (slice) }}
<div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}</span>{{ .Title }}</div>
<div class="grid">
<div class="leftcolumn">
@ -17,22 +19,36 @@
{{ end }}
</div>
<div class="rightcolumn">
{{- range $k, $v := .Page.Params.authors -}}
{{- with $.GetPage (printf "/author/%s" $v) -}}
{{ $closeDivs := false }}
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
{{ $sandnamePlural = $sandnamePlural | append $v }}
{{ end }}
{{ $paramsKeys := (slice) }}
{{ range $k, $v := $currentNode.Params }}
{{ $paramsKeys = $paramsKeys | append $k }}
{{ end }}
{{ $mentions := intersect $paramsKeys $sandnamePlural }}
{{ range $mention := $mentions }}
{{ range $k, $m := index $currentNode.Params $mention }}
{{ $mentionLink := printf "/%s/%s" (substr $mention 0 -1) $m }}
{{- with $.GetPage $mentionLink -}}
{{- with not $k -}}
{{ $closeDivs = true }}
<div class="has hasauthors">
<div class="hassup">author{{ with $.Page.Params.authors }}{{ if gt (len .) 1 }}s{{ end }}{{ end }}</div>
<div class="hassup">{{ with (index $currentNode.Params $mention) }}{{ if gt (len (index $currentNode.Params $mention)) 1 }}{{ $mention }}{{ else }}{{ substr $mention 0 -1 }}{{ end }}{{ end }}</div>
<div class="afterhas">
{{- end -}}
<div class="crust">
<a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
</div>
{{- end -}}
{{- end -}}
{{- with .Page.Params.authors -}}</div></div>{{- end -}}
{{ end }}
{{ end }}
{{- with $closeDivs -}}</div></div>{{ end }}
{{ if in .Page.Site.Params.sandpointsMentionedIn (substr $currentDir 0 -1) }}
<div class="has">
<div class="has hasmentionedin">
{{ with $scratch.backlinks }}
<div class="hassup">mentioned in</div>
{{ end }}
@ -46,7 +62,7 @@
{{ end }}
{{ if and (not (eq $scratch.depth "crust")) $scratch.has_children }}
<div class="has">
<div class="has hashas">
{{ with $scratch.has }}
<div class="hassup">has {{ $scratch.has }}</div>
{{ end }}
@ -60,7 +76,7 @@
{{ end }}
{{ if eq $scratch.depth "crust" }}
<div class="has">
<div class="has hasin">
<div class="hassup">in {{ index $scratch.in 1 }}</div>
<div class="afterhas">
{{ range $scratch.is_in }}
@ -74,8 +90,6 @@
</div>
{{ with .Page.Params.abstract }}<div class="journal"></div><div class="abstract"><span class="supt">abstract</span>{{ . | $.Page.RenderString | htmlUnescape | safeHTML }}</div>{{ end }}
{{ with .Page.Params.abstract }}<div class="abstract"><span class="supt">abstract</span>{{ . | $.Page.RenderString | htmlUnescape | safeHTML }}</div>{{ end }}
{{- $vld := false -}}{{- range $k, $v := .Page.Params.keywords -}}{{- if eq $k 0 -}}{{- $vld = true -}}<div
class="keywords"><span class="sup">keywords</span>{{- $v -}}{{- else -}},&nbsp;{{- $v -}}{{- end -}}{{- end -}}{{- with $vld -}}</div>{{- end -}}
{{ with .Page.Params.abstract }}</div>{{ end }}
{{- $vld := false -}}{{- range $k, $v := .Page.Params.keywords -}}{{- if eq $k 0 -}}{{- $vld = true -}}<div class="keywords"><span class="sup">keywords</span>{{- $v -}}{{- else -}},&nbsp;{{- $v -}}{{- end -}}{{- end -}}{{- with $vld -}}</div>{{- end -}}

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,4 @@
<link href="/css/paged_interface.css" rel="stylesheet" type="text/css">
<link href="/css/print.css" rel="stylesheet" type="text/css">
<script src="/js/paged.polyfill.js"></script>
<script src="/js/repeatingHeader.js"></script>

View file

@ -53,17 +53,8 @@
{{ end }}
<div class="afterhas">
{{ range $scratch.has_children }}
{{ $authors := "" }}
{{ range $n, $authorFile := .Params.authors }}
{{ $author := $.GetPage (printf "/author/%s" $authorFile) }}
{{ if eq $n 0 }}
{{ $authors = printf "%s%s" $authors $author.Title }}
{{ else }}
{{ $authors = printf "%s, %s" $authors $author.Title }}
{{ end }}
{{ end }}
<div class="{{ $scratch.child_depth }}">
<a class="toc" href="#{{ .File.LogicalName }}">{{ .Title }} ({{ $authors }})</a>
<a class="toc" href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{ end }}
</div></div>

View file

@ -41,8 +41,10 @@
{{ range $m := index $p.Params $mention }}
{{ $mentionLink := printf "/%s/%s" (substr $mention 0 -1) $m }}
{{ with ($_.Get $mentionLink) }}
{{ $p.Scratch.Add "links" (uniq (($p.Scratch.Get "links")| append ($.GetPage $mentionLink))) }}
{{ $_.SetInMap $mentionLink "backlinks" (uniq ((index ($_.Get $mentionLink) "backlinks") | append $p)) }}
{{ else }}
{{ $p.Scratch.Add "links" (uniq (($p.Scratch.Get "links")| append ($.GetPage $mentionLink))) }}
{{ $_.SetInMap $mentionLink "backlinks" (slice $p) }}
{{ end }}
{{ end }}

View file

@ -8,7 +8,12 @@
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}
<div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
{{ $sandnamePlural := (slice) }}
{{ with (index $currentNode.Params "authors") }}
{{ len (index $currentNode.Params "authors") }}
{{ end }}
div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
<div class="grid">
<div class="leftcolumn">
@ -17,22 +22,36 @@
{{ end }}
</div>
<div class="rightcolumn">
{{- range $k, $v := .Page.Params.authors -}}
{{- with $.GetPage (printf "/author/%s" $v) -}}
{{ $closeDivs := false }}
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
{{ $sandnamePlural = $sandnamePlural | append $v }}
{{ end }}
{{ $paramsKeys := (slice) }}
{{ range $k, $v := $currentNode.Params }}
{{ $paramsKeys = $paramsKeys | append $k }}
{{ end }}
{{ $mentions := intersect $paramsKeys $sandnamePlural }}
{{ range $mention := $mentions }}
{{ range $k, $m := index $currentNode.Params $mention }}
{{ $mentionLink := printf "/%s/%s" (substr $mention 0 -1) $m }}
{{- with $.GetPage $mentionLink -}}
{{- with not $k -}}
{{ $closeDivs = true }}
<div class="has hasauthors">
<div class="hassup">author{{ with $.Page.Params.authors }}{{ if gt (len .) 1 }}s{{ end }}{{ end }}</div>
<div class="hassup">{{ with (index $currentNode.Params $mention) }}{{ if gt (len (index $currentNode.Params $mention)) 1 }}{{ $mention }}{{ else }}{{ substr $mention 0 -1 }}{{ end }}{{ end }}</div>
<div class="afterhas">
{{- end -}}
<div class="crust">
<a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
</div>
{{- end -}}
{{- end -}}
{{- with .Page.Params.authors -}}</div></div>{{- end -}}
{{ end }}
{{ end }}
{{- with $closeDivs -}}</div></div>{{ end }}
{{ if in .Page.Site.Params.sandpointsMentionedIn (substr $currentDir 0 -1) }}
<div class="has">
<div class="has hasmentionedin">
{{ with $scratch.backlinks }}
<div class="hassup">mentioned in</div>
{{ end }}
@ -46,7 +65,7 @@
{{ end }}
{{ if and (not (eq $scratch.depth "crust")) $scratch.has_children }}
<div class="has">
<div class="has hashas">
{{ with $scratch.has }}
<div class="hassup">has {{ $scratch.has }}</div>
{{ end }}
@ -60,7 +79,7 @@
{{ end }}
{{ if eq $scratch.depth "crust" }}
<div class="has">
<div class="has hasin">
<div class="hassup">in {{ index $scratch.in 1 }}</div>
<div class="afterhas">
{{ range $scratch.is_in }}
@ -74,8 +93,6 @@
</div>
{{ with .Page.Params.abstract }}<div class="journal"></div><div class="abstract"><span class="supt">abstract</span>{{ . | $.Page.RenderString | htmlUnescape | safeHTML }}</div>{{ end }}
{{ with .Page.Params.abstract }}<div class="abstract"><span class="supt">abstract</span>{{ . | $.Page.RenderString | htmlUnescape | safeHTML }}</div>{{ end }}
{{- $vld := false -}}{{- range $k, $v := .Page.Params.keywords -}}{{- if eq $k 0 -}}{{- $vld = true -}}<div
class="keywords"><span class="sup">keywords</span>{{- $v -}}{{- else -}},&nbsp;{{- $v -}}{{- end -}}{{- end -}}{{- with $vld -}}</div>{{- end -}}
{{ with .Page.Params.abstract }}</div>{{ end }}
{{- $vld := false -}}{{- range $k, $v := .Page.Params.keywords -}}{{- if eq $k 0 -}}{{- $vld = true -}}<div class="keywords"><span class="sup">keywords</span>{{- $v -}}{{- else -}},&nbsp;{{- $v -}}{{- end -}}{{- end -}}{{- with $vld -}}</div>{{- end -}}

View file

@ -5,7 +5,6 @@
<div id="toggleAllLinks" onclick="toggleAllLinks()">[toggle expand/collapse]</div>
<p></p>
{{ range $p := .Site.RegularPages }}
{{ with or ($p.Scratch.Get "urls") ($p.Scratch.Get "bibs") ($p.Scratch.Get "links") ($p.Scratch.Get "backlinks" )}}
<details><summary>{{ with $p.File }}<span class="sup">{{- substr .Dir 0 -1 -}}</span>{{ end }}<a href="{{ $p.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ $p.Title }}</a></summary>
{{ $pPath := printf "/%s" $p.File }}
@ -22,9 +21,9 @@
{{ end }}
{{ with ($p.Scratch.Get "links") }}
{{ range $i, $_ := ($p.Scratch.Get "links") }}
{{ range $i, $_ := uniq ($p.Scratch.Get "links") }}
{{ if eq $i 0 }}
<details><summary>Internal links to other Sandpoint pages ({{ len ($p.Scratch.Get "links") }}):</summary><ul>
<details><summary>Internal links to other Sandpoint pages ({{ len (uniq ($p.Scratch.Get "links")) }}):</summary><ul>
{{ end }}
<li>{{ with $_.File }}<span class="sup">{{ substr .Dir 0 -1 }}</span>{{ end }}<a href="{{ $_.RelPermalink }}">{{ $_.Title }}</a></li>
{{ end }}
@ -102,5 +101,4 @@
</details>
{{ end }}
{{ end }}
{{ end }}

View file

@ -1,13 +1,13 @@
@page {
size: 156mm 234mm;
margin-bottom: 58px;
padding-bottom: 20px;
margin-top: 40px;
margin-bottom: 0.8in;
padding-bottom: 0.2in;
margin-top: 0.7in;
}
@page:left {
margin-right: 40px;
margin-left: 64px;
margin-right: 0.7in;
margin-left: 1in;
@bottom-left-corner {
content: counter(page);
font-size: 1rem;
@ -21,8 +21,8 @@
}
@page:right {
margin-left: 40px;
margin-right: 64px;
margin-left: 0.7in;
margin-right: 1in;
@bottom-right-corner {
content: counter(page);
font-size: 1rem;
@ -169,24 +169,15 @@
break-after: avoid;
}
table {
font-size: 1rem;
}
.glosscontainer,
table,
table + p,
tr,
blockquote,
li {
break-inside: avoid;
}
.toc::after {
text-align: right;
float: right;
content: target-counter(attr(href url), page, decimal-leading-zero);
}
.authorpage {
break-before: page;
}
@ -202,4 +193,39 @@
img + strong del {
margin-left: 0;
}
.crustoc {
position: relative;
bottom: 0
}
.crustoc::after {
content: " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ";
line-height: 0;
height: 1px;
position: absolute;
bottom: 10px;
z-index: -1;
}
a.toc {
display: grid;
grid-template-columns: 1fr auto;
align-items: flex-end;
}
a.toc span {
}
a.toc .back {
background: white;
}
a.toc::after {
text-align: right;
float: right;
content: target-counter(attr(href url), page, decimal-leading-zero);
background: white;
padding-left: 0.1rem;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
class RepeatingTableHeaders extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
afterPageLayout(pageElement, page, breakToken, chunker) {
// Find all split table elements
let tables = pageElement.querySelectorAll("table[data-split-from]");
tables.forEach((table) => {
// There is an edge case where the previous page table
// has zero height (isn't visible).
// To avoid double header we will only add header if there is none.
let tableHeader = table.querySelector("thead");
if (tableHeader) {
return;
}
// Get the reference UUID of the node
let ref = table.dataset.ref;
// Find the node in the original source
let sourceTable = chunker.source.querySelector("[data-ref='" + ref + "']");
// Find if there is a header
let sourceHeader = sourceTable.querySelector("thead");
if (sourceHeader) {
console.log("Table header was cloned, because it is splitted.");
// Clone the header element
let clonedHeader = sourceHeader.cloneNode(true);
// Insert the header at the start of the split table
table.insertBefore(clonedHeader, table.firstChild);
}
});
// Find all tables
tables = pageElement.querySelectorAll("table");
// special case which might not fit for everyone
tables.forEach((table) => {
// if the table has no rows in body, hide it.
// This happens because my render engine creates empty tables.
let sourceBody = table.querySelector("tbody > tr");
if (!sourceBody) {
console.log("Table was hidden, because it has no rows in tbody.");
table.style.visibility = "hidden";
table.style.position = "absolute";
var lineSpacer = table.nextSibling;
if (lineSpacer) {
lineSpacer.style.visibility = "hidden";
lineSpacer.style.position = "absolute";
}
}
});
}
}
Paged.registerHandlers(RepeatingTableHeaders);