volumetric-regimes-book/command-line/js/runHyphens.js
2022-06-09 10:08:00 +02:00

23 lines
579 B
JavaScript

class hyphenopoly extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller);
}
beforeParsed(content) {
// add lang en-us 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);