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.
 
 
 
 

92 lines
2.9 KiB

{% extends "base.html" %}
{% block head %}
<link href="{{ url_for('static', filename='css/pagedjs.css')}}" rel="stylesheet" type="text/css" media="screen">
<link href="{{ url_for('static', filename='css/print.css')}}" rel="stylesheet" type="text/css" media="print">
<!-- <link href="{{ url_for('static', filename='css/baseline.css')}}" rel="stylesheet" type="text/css" media="print"> -->
<script>
// 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="{{ url_for('static', filename='js/hyphens/Hyphenopoly_Loader.js')}}"></script>
<script src="{{ url_for('static', filename='js/paged.polyfill.js')}}" type="text/javascript"></script>
<script src="{{ url_for('static', filename='js/runHyphens.js')}}"></script>
{% endblock %}
{% block content %}
{{ publication_unfolded | safe }}
<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>
{% endblock %}
<!--
<script>
window.addEventListener('load', function () {
// Add the main.css again to insert the nav css
var cssLink = document.createElement('link');
cssLink.rel = 'stylesheet';
cssLink.href = '/static/css/main.css';
cssLink.media = 'screen';
var head = document.getElementsByTagName('head')[0];
head.insertBefore(cssLink, head.firstChild);
})
</script>
-->
{% block footer %}
<br>
{% endblock %}