Add fonts and styling for articles
Note: Due to nodepub limitations, the fonts are only named, but not actually embedded. To embed them, you'll have to do something roundabout like opening the ePub in the Calibre ePub Editor and embedding them from there. Hopefully this will get resolved at some point :/
This commit is contained in:
parent
d475a5bde9
commit
1ddc5f4e7c
1 changed files with 46 additions and 2 deletions
48
seance.js
48
seance.js
|
@ -744,8 +744,8 @@ class Seance {
|
||||||
allPosts.push(post)
|
allPosts.push(post)
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare for image downloads
|
// prepare for image downloads, starting with the scissors!
|
||||||
let pics = []
|
let pics = [path.join(__dirname, 'scissors.png')]
|
||||||
let picFolder = path.join(options.outputFolder, 'seance-images')
|
let picFolder = path.join(options.outputFolder, 'seance-images')
|
||||||
if (!fs.existsSync(picFolder)) {
|
if (!fs.existsSync(picFolder)) {
|
||||||
fs.mkdirSync(picFolder, { recursive: true })
|
fs.mkdirSync(picFolder, { recursive: true })
|
||||||
|
@ -835,6 +835,50 @@ class Seance {
|
||||||
epub.addSection(post.title, post.body)
|
epub.addSection(post.title, post.body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add the styles
|
||||||
|
epub.addCSS(`
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-family: "Abhaya Libre Extrabold";
|
||||||
|
text-transform: lowercase;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 3.6em;
|
||||||
|
line-height: 1em;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 + h2 {
|
||||||
|
font-family: "Open Sans Light";
|
||||||
|
font-variant: small-caps;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.2em;
|
||||||
|
line-height: 1em;
|
||||||
|
margin-bottom: 2.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-family: "Crimson Text Regular";
|
||||||
|
font-size: 1em;
|
||||||
|
line-height: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
display: block;
|
||||||
|
border: 0px;
|
||||||
|
height: 1em;
|
||||||
|
background-image:url('../images/scissors.png');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 50%;
|
||||||
|
margin-top: 1.5em;
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
// generate it!
|
// generate it!
|
||||||
await epub.writeEPUB(options.outputFolder, options.title)
|
await epub.writeEPUB(options.outputFolder, options.title)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue