36 lines
1,001 B
JavaScript
36 lines
1,001 B
JavaScript
import { Handler } from '/csspageweaver/lib/paged.esm.js';
|
|
|
|
export default class thesis extends Handler {
|
|
constructor(chunker, polisher, caller) {
|
|
super(chunker, polisher, caller);
|
|
}
|
|
|
|
beforeParsed(content){
|
|
|
|
const strongs = content.querySelectorAll('strong');
|
|
strongs.forEach(strong => {
|
|
if (/^these\s+\d+/i.test(strong.textContent.trim())) {
|
|
const parent = strong.closest('p');
|
|
if (parent) {
|
|
parent.classList.add('p-these');
|
|
}
|
|
}
|
|
});
|
|
|
|
const theseParas = content.querySelectorAll('.p-these');
|
|
theseParas.forEach(p => {
|
|
let next = p.nextElementSibling;
|
|
while (next && next.tagName.toLowerCase() === 'ol') {
|
|
next = next.nextElementSibling;
|
|
}
|
|
if (!next || !next.classList.contains('p-these')) {
|
|
p.classList.add('p-these-last');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|