mirror of
https://github.com/nature-of-code/noc-book-2
synced 2024-11-17 07:49:05 +01:00
Merge pull request #509 from nature-of-code/dev/add-chapter-opening-only-build
This commit is contained in:
commit
a4ec039e3c
2 changed files with 32 additions and 23 deletions
|
@ -11,10 +11,10 @@
|
|||
"magicbook/plugins/chapter-opening.js",
|
||||
"magicbook/plugins/callout.js"
|
||||
],
|
||||
"destination": "build",
|
||||
"files": [
|
||||
"content/*.html"
|
||||
],
|
||||
"layout": "magicbook/layouts/pdf.html",
|
||||
"images": {
|
||||
"colorspace": "grey16",
|
||||
"files": [
|
||||
|
@ -23,10 +23,6 @@
|
|||
"magicbook/images/**/*.*"
|
||||
]
|
||||
},
|
||||
"builds": [
|
||||
{
|
||||
"format": "pdf",
|
||||
"layout": "magicbook/layouts/pdf.html",
|
||||
"stylesheets": {
|
||||
"files": [
|
||||
"magicbook/stylesheets/index.scss"
|
||||
|
@ -35,7 +31,16 @@
|
|||
"fonts": {
|
||||
"files": "magicbook/fonts/**/*.*",
|
||||
"destination": "assets/fonts/"
|
||||
}
|
||||
},
|
||||
"builds": [
|
||||
{
|
||||
"format": "pdf",
|
||||
"destination": "build/chapter-opening-preview",
|
||||
"chapterOpeningPagesOnly": true
|
||||
},
|
||||
{
|
||||
"format": "pdf",
|
||||
"destination": "build/full"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -19,7 +19,7 @@ Plugin.prototype = {
|
|||
|
||||
// match the number and name
|
||||
const match = /(\d+)\.\s([A-Za-z\s]+)/.exec(chapterTitle.text());
|
||||
|
||||
if (match) {
|
||||
chapterTitle.replaceWith(
|
||||
`<div class="chapter-opening"><div class="chapter-opening-header"><span class="chapter-number">${match[1]}</span><div class="chapter-opening-title"><h1>${match[2]}</h1></div></div></div>`,
|
||||
);
|
||||
|
@ -35,7 +35,11 @@ Plugin.prototype = {
|
|||
if (chapterOpeningFigure) {
|
||||
file.$el('div.chapter-opening').append(chapterOpeningFigure);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.chapterOpeningPagesOnly) {
|
||||
file.$el('div.chapter-opening').nextAll().remove();
|
||||
}
|
||||
cb(null, file);
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue