volumetric-regimes-book/web-interface/static/js/runHyphens.js
2021-12-03 00:11:42 +01:00

23 lines
576 B
JavaScript

class hyphenopoly extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
beforeParsed(content) {
// add lang fr to all sections
content.querySelectorAll("section").forEach(section => {
section.setAttribute("lang", "en-us")
})
Object.keys(Hyphenopoly.setup.selectors).forEach(sel => {
content.querySelectorAll(sel).forEach(elem => {
Hyphenopoly.hyphenators["HTML"].then((hyn) => {
hyn(elem, sel);
});
});
});
}
}
Paged.registerHandlers(hyphenopoly);