print setup for dotawo's issue..

This commit is contained in:
Marcell Mars 2021-02-03 02:50:21 +01:00
parent c9d96eb9af
commit bfe91a464c
8 changed files with 357 additions and 75 deletions

View file

@ -117,12 +117,28 @@ th:not([align]) {
/* Legacy iOS */
}
@font-face {
font-family: "Antinoou";
font-style: normal;
src: url("../fonts/Antinoou.ttf"),
url("../fonts/Antinoou.ttf") format("truetype");
unicode-range: U+2C80U+2CFF, U+0370U+03FF, U+102E0U+102FF;
}
@font-face {
font-family: "Antinoou";
font-style: italic;
src: url("../fonts/AntinoouItalic.ttf"),
url("../fonts/AntinoouItalic.ttf") format("truetype");
unicode-range: U+2C80U+2CFF, U+0370U+03FF, U+102E0U+102FF;
}
html {
line-height: 1.5;
}
body {
font-family: "Gentium Plus", serif;
font-family: "Gentium Plus", "Antinoou", serif;
max-width: 1024px;
font-size: 1.4rem;
padding-left: 3rem;
@ -735,63 +751,3 @@ details {
display: none;
}
}
@media print {
@page {
size: 156mm 234mm;
marks: crop cross;
}
h2 {
break-before: page;
}
html {
font-size: 0.9rem;
box-sizing: border-box;
margin: 0 auto;
padding: 0;
}
.grid {
display: inline;
}
.coretitle {
margin-top: 3rem;
margin-bottom: 2rem;
font-size: 2.2rem;
}
.leftcolumn {
display: none;
}
.has,
.afterhas {
font-size: 1.1rem;
}
.mantle,
.crust {
margin-bottom: 0.2em;
}
.content {
padding: 0px;
margin: 0 auto;
margin-top: 4rem;
}
.hpar {
display: none;
}
.mantletitle {
font-size: 1.7rem;
}
.sessiongrid {
display: none;
}
}

View file

@ -0,0 +1,89 @@
{{ $s := partialCached "scratch.html" . }}
{{ $currentNode := . }}
{{ $currentDir := "" }}
{{ with .File }}
{{ $currentDir = .Dir }}
{{ end }}
{{ $currentFile := (printf "/%s" .File) }}
{{ $scratch := $s.Get $currentFile }}
<div id="{{ .File.LogicalName }}" class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}</span>{{ .Title }}</div>
<div class="grid">
<div class="leftcolumn">
{{ if ne (trim .Page.TableOfContents "\n") "<nav id=\"TableOfContents\"></nav>" }}
{{ .Page.TableOfContents }}
{{ end }}
</div>
<div class="rightcolumn">
{{- range $k, $v := .Page.Params.editors -}}
{{- with $.GetPage (printf "/editor/%s" $v) -}}
{{- with not $k -}}
<div class="has hasauthors">
<div class="hassup">editor{{ with $.Page.Params.editors }}{{ if gt (len .) 1 }}s{{ end }}{{ end }}</div>
<div class="afterhas">
{{- end -}}
<div class="crust">
<a href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{- end -}}
{{- end -}}
{{- with .Page.Params.editors -}}</div></div>{{- end -}}
{{- range $k, $v := .Page.Params.authors -}}
{{- with $.GetPage (printf "/author/%s" $v) -}}
{{- with not $k -}}
<div class="has hasauthors">
<div class="hassup">author{{ with $.Page.Params.authors }}{{ if gt (len .) 1 }}s{{ end }}{{ end }}</div>
<div class="afterhas">
{{- end -}}
<div class="crust">
<a href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{- end -}}
{{- end -}}
{{- with .Page.Params.authors -}}</div></div>{{- end -}}
{{ if and (not (eq $scratch.depth "crust")) $scratch.has_children }}
<div class="has hashas">
{{ with $scratch.has }}
<div class="hassup">has {{ $scratch.has }}</div>
{{ 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>
</div>
{{ end }}
</div></div>
{{ end }}
{{ if eq $scratch.depth "crust" }}
<div class="has hasin">
<div class="hassup">in {{ index $scratch.in 1 }}</div>
<div class="afterhas">
{{ range $scratch.is_in }}
<div class="{{ substr $currentDir 0 -1 }}">
<a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a>
</div>
{{ end }}
</div></div>
{{ end }}
</div>
</div>
{{ 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 -}}

Binary file not shown.

Binary file not shown.

View file

@ -1,2 +1,3 @@
<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>

View file

@ -6,8 +6,6 @@
{{- partial "pagedjs.html" . -}}
</head>
<body>
<article>
{{- block "singlebody" . -}}{{- end -}}
</article>
</body>
</html>

View file

@ -8,17 +8,50 @@
{{ $currentDir = .Dir }}
{{ end }}
<div class="print0">{{ partial "singlebody.html" $p }}</div>
<div class="content">{{ $p.Content }}
{{ range $printPage := $scratch.has_cildren }}
<div class="print1">{{ partial "singlebody.html" $printPage }}</div>
<div class="content">{{ $printPage.Content }}
{{ $printPageScratch := $s.Get (printf "/%s" $printPage.File) }}
{{ range $printPageKid := $printPageScratch.has_children }}
<div class="print2">{{ partial "singlebody.html" $printPageKid }}</div>
<div class="content">{{ $printPageKid.Content }}
{{ . }}
{{ end }}
</div>
<div class="print0">{{ partial "printsinglebody.html" $p }}</div>
<div class="content">{{ $p.Content }}</div>
{{ range $scratch.has_children }}
<div class="crustpage">
{{ $addS := len .Params.authors }}
{{ 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="#{{ $author.File.LogicalName }}">{{ $author.Title }}</a>
{{ else }}
, <a href="#{{ $author.File.LogicalName }}">{{ $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="#{{ .File.LogicalName }}">{{ $tit }}</a></div>
{{ partial "printsinglebody.html" . }}
{{ .Content }}
{{ end }}
{{ range where $.Site.RegularPages "Section" "in" (slice "author" "editor") }}
<div class="authorpage">
<div class="runningTitle runningAuthors"><span class="sup">{{ index $scratch.mantle 0 }}</span><a href="#{{ $p.File.LogicalName }}">{{ $p.Title }}</a></div>
<div id="{{ .File.LogicalName }}" class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr .File.Dir 0 -1 }}</span>{{ .Title }}</div>
{{ .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 }}">
<a href="#{{ .File.LogicalName }}">{{ .Title }}</a>
</div>
{{ end }}
</div></div>
{{ end }}
{{ end }}
{{- end -}}

205
static/css/print.css Normal file
View file

@ -0,0 +1,205 @@
@page {
size: 156mm 234mm;
margin-bottom: 58px;
padding-bottom: 20px;
margin-top: 40px;
}
@page:left {
margin-right: 40px;
margin-left: 64px;
@bottom-left-corner {
content: counter(page);
font-size: 1rem;
vertical-align: text-top;
}
@bottom {
content: element(runningTitle);
position: relative;
}
}
@page:right {
margin-left: 40px;
margin-right: 64px;
@bottom-right-corner {
content: counter(page);
font-size: 1rem;
vertical-align: text-top;
}
@bottom {
content: element(runningAuthors);
position: relative;
}
}
@page crustpage :first {
@bottom-right-corner {
content: none;
}
@bottom {
content: none;
}
}
@media print {
html {
font-size: 0.8em;
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-size: 1rem;
padding: 0;
margin: 0;
}
.grid {
display: inline;
}
.coretitle {
margin-top: 3rem;
margin-bottom: 2rem;
font-size: 2.2rem;
}
.leftcolumn {
display: none;
}
.has,
.afterhas {
font-size: 1.1rem;
}
.mantle,
.crust {
margin-bottom: 0.2em;
}
.content {
padding: 0px;
margin: 0 auto;
margin-top: 4rem;
}
.hpar {
display: none;
}
.mantletitle {
font-size: 1.7rem;
}
.sessiongrid {
display: none;
}
#bibliography {
break-before: page;
}
.footnotes ol {
margin-top: 3rem;
padding-left: 0.9rem;
}
.footnotes hr {
border: none;
border-top: 0px;
text-align: left;
margin-top: 2rem;
margin-bottom: -2rem;
}
.footnotes hr::after {
content: "Endnotes";
font-size: 1.2rem;
font-weight: bold;
}
.runningTitle {
position: running(runningTitle);
}
.runningAuthors {
position: running(runningAuthors);
}
.hasauthors .afterhas {
font-size: 1.5rem;
}
.crustpage {
break-before: page;
page: crustpage;
}
.hasin {
display: none;
}
.abstract {
margin-left: 0;
margin-right: 0;
max-width: inherit;
}
.keywords {
margin-left: 0;
margin-right: 0;
max-width: inherit;
padding-left: 0;
padding-right: 0;
font-size: 0.9rem;
}
h2:before,
h3:before,
h4:before,
h5:before {
content: none;
}
h2, h3, h4, h5, hr {
break-after: avoid;
}
table {
font-size: 1rem;
}
.glosscontainer,
table,
table + p,
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;
}
img {
display: block;
max-height: 150mm;
width: auto;
break-after: avoid;
margin-bottom: 0.5rem;
}
img + strong del {
margin-left: 0;
}
}