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