Tools for generating the Volumetric Regimes book https://volumetricregimes.xyz/ (wiki-to-print, using Paged.js)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.8 KiB
79 lines
2.8 KiB
<!DOCTYPE html>
|
|
<html lang="en-us">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<link href="./css/pagedjs.css" rel="stylesheet" type="text/css">
|
|
<link href="./css/print.css" rel="stylesheet" type="text/css" media="print">
|
|
<!-- BASELINE GRID -->
|
|
<!-- <link href="./css/baseline.css" rel="stylesheet" type="text/css" media="print"> -->
|
|
<!-- ------------- -->
|
|
<script>
|
|
// Hyphenopoly is used for the hyphenation of the book.
|
|
// Thank you paged.js team for the Hyphenopoly tip!
|
|
// config for hyphenopoly
|
|
var Hyphenopoly = {
|
|
require: {
|
|
"en-us": "FORCEHYPHENOPOLY"
|
|
},
|
|
paths: {
|
|
patterndir: "./js/hyphens/patterns/",
|
|
maindir: "./js/hyphens/"
|
|
},
|
|
setup: {
|
|
dontHyphenateClass: "noHyphen",
|
|
safeCopy: false,
|
|
hide: "nothing",
|
|
selectors: {
|
|
"p": {
|
|
hyphen: "\u00AD",
|
|
// hyphen: "•",
|
|
compound: "all",
|
|
minWordLength: 5,
|
|
leftmin: 3,
|
|
rightmin: 0,
|
|
orphanControl: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<script src="./js/hyphens/Hyphenopoly_Loader.js"></script>
|
|
<script src="./js/paged.polyfill.js"></script>
|
|
<script src="./js/runHyphens.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="wrapper">
|
|
{{ publication_unfolded }}
|
|
</div>
|
|
<script>
|
|
// With many thanks to Julien Taquet for digging into Paged.js
|
|
// to find a way to remove hyphenated words on page breaks!!
|
|
class noHyphenBetweenPage extends Paged.Handler {
|
|
constructor(chunker, polisher, caller) {
|
|
super(chunker, polisher, caller);
|
|
this.hyphenToken;
|
|
}
|
|
afterPageLayout(pageFragment, page, breakToken) {
|
|
if (pageFragment.querySelector('.pagedjs_hyphen')) {
|
|
// find the hyphenated word
|
|
let block = pageFragment.querySelector('.pagedjs_hyphen');
|
|
block.dataset.ref = this.prevHyphen;
|
|
// move the breakToken
|
|
let offsetMove = getFinalWord(block.innerHTML).length;
|
|
// move the token accordingly
|
|
page.breakToken = page.endToken.offset - offsetMove;
|
|
// remove the last word
|
|
block.innerHTML = block.innerHTML.replace(getFinalWord(block.innerHTML), "");
|
|
breakToken.offset = page.endToken.offset - offsetMove;
|
|
}
|
|
}
|
|
}
|
|
Paged.registerHandlers(noHyphenBetweenPage);
|
|
|
|
function getFinalWord(words) {
|
|
var n = words.split(" ");
|
|
return n[n.length - 1];
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|