This commit is contained in:
Anton 2021-04-11 15:56:38 +03:00
parent cc6e7cd732
commit 6037accae2
4 changed files with 2846 additions and 3 deletions

File diff suppressed because it is too large Load Diff

198
docs/pdf.css Normal file
View File

@ -0,0 +1,198 @@
body {
margin: 5%;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen, Ubuntu, Cantarell, "PT Sans", "Open Sans", "Fira Sans",
"Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: medium;
line-height: 1.6;
}
code {
font-family: Consolas, "Lucida Console", Monaco, monospace;
}
/* 1.0 CSS to make A4 print preview as default web view */
@media screen {
.pagedjs_pages {
display: flex;
width: calc(var(--pagedjs-width));
flex: 0;
flex-wrap: wrap;
margin: 0 auto;
justify-content: center;
}
.pagedjs_page {
margin: 10mm;
border: solid 1px gray;
}
}
/* 2.0 General Formatting */
h1 {
border-bottom: 1px solid black;
margin-bottom: 2rem;
padding-bottom: 0.5rem;
line-height: 1.2;
}
h2 {
border-bottom: 0.1875rem solid black;
margin-bottom: 1rem;
padding-bottom: 0.5rem;
line-height: 1.2;
}
h3 {
line-height: 1.2;
}
p {
text-align: justify;
hyphens: auto;
}
a {
color: #347dbd;
}
a:hover {
color: #fc814a;
}
mark {
color: purple;
background-color: inherit;
}
light-mark {
color: purple;
}
img {
max-width: calc(100% - 3rem);
border: 1px solid #eaeaea;
padding: 1rem;
}
.img-75mm {
height: 75mm;
}
center {
border: 0.5px solid gray;
padding: 1.5rem;
}
pre {
background-color: #f0f0f0;
padding: 1rem;
font-size: smaller;
white-space: pre-wrap;
}
code {
display: block;
}
figure {
margin-inline-start: 0rem;
margin-inline-end: 0rem;
break-inside: avoid;
}
figcaption {
caption-side: top;
color: gray;
}
/* 3.1 Page Size */
@page {
size: A4;
}
/* 3.2 Page Breaks */
.page-break {
break-after: page;
}
.avoid-break {
break-inside: avoid;
}
h2:not(.no-break) {
break-before: page;
margin-block-start: 0rem;
margin-block-end: 1.66rem;
}
h2.no-break:not(.top) {
margin-block-start: 3rem;
margin-block-end: 1.66rem;
}
h2.top {
margin-block-start: 0rem;
margin-block-end: 1.66rem;
}
h3:not(.top) {
margin-block-start: 2.49rem;
margin-block-end: 0.83rem;
}
h3.top {
margin-block-start: 1.66rem;
margin-block-end: 0.83rem;
}
/* 3.3 Page Numbers */
@page {
@bottom-right {
content: counter(page);
}
}
/* We use the counter-reset class to prevent the page
numbers starting from the cover page, but rather
from the next page (table of contents) */
.counter-reset {
counter-reset: page 1;
}
/* 4.1 Automatic Counters */
body {
counter-reset: sectionNumber;
counter-reset: subsectionNumber;
counter-reset: figureNumber;
}
/* 4.2 Headers & Footers */
.footer {
position: running(footerRunning);
}
@page {
@bottom-left {
content: element(footerRunning);
width: 80mm;
}
}
h2 {
string-set: section content(text);
}
h3 {
string-set: subsection content(text);
}
@page {
@top-right {
content: string(section);
/* ALT: content: string(section) " - " string(subsection); */
}
}
/* 4.3 Cover Pages */
.cover-page {
page: cover-page;
}
.cover-page h1 {
border-bottom: 0.25rem solid white;
}
.cover-page h3 {
font-weight: normal;
}
@page cover-page {
background-color: #2385fb; /*347dbd;*/
color: white;
@top-right {
content: none;
}
@bottom-left {
content: none;
}
@bottom-right {
content: none;
}
}

View File

@ -1,4 +1,6 @@
cd build cd build
pandoc --css epub.css -o data-visualization-guide.epub data-visualization-guide.md pandoc --css epub.css -o data-visualization-guide.epub data-visualization-guide.md
# (</(?:h2|p|img|ul|pre)>)\s* # (<(?:h1|h2|h3|p|img|ul|ol|li|pre)>)\s* -- \n$1
# \s+< -- <
# <p>(<img.+alt="([^"]+)"[^>]*>)</p> -- <figure>$1<figcaption>$2</figcaption></figure>

View File

@ -1,7 +1,8 @@
cp -r docs/img build cp -r docs/img build
cp docs/epub.css build cp docs/epub.css build
cp docs/pdf.css build
cat \ cat \
docs/title.md \ docs/00-title.md \
docs/01-say.md \ docs/01-say.md \
docs/02-structure.md \ docs/02-structure.md \
docs/04-express.md \ docs/04-express.md \
@ -9,7 +10,7 @@ cat \
docs/06-condense.md \ docs/06-condense.md \
docs/07-check.md \ docs/07-check.md \
docs/09-unify.md \ docs/09-unify.md \
docs/epilogue.md \ docs/10-epilogue.md \
> build/data-visualization-guide.md > build/data-visualization-guide.md
cd build cd build
sed -E -e 's/docs\///g' -i '' data-visualization-guide.md sed -E -e 's/docs\///g' -i '' data-visualization-guide.md