23 lines
576 B
JavaScript
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);
|