2021-11-26 18:59:40 +01:00
|
|
|
class hyphenopoly extends Paged.Handler {
|
|
|
|
constructor(chunker, polisher, caller) {
|
|
|
|
super(chunker, polisher, caller);
|
|
|
|
}
|
|
|
|
beforeParsed(content) {
|
|
|
|
|
2022-06-09 10:08:00 +02:00
|
|
|
// add lang en-us to all sections
|
2021-11-26 18:59:40 +01:00
|
|
|
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);
|