thesis script

This commit is contained in:
Julie Blanc 2026-04-09 22:03:28 +02:00
parent dcdd26de82
commit 5715733a40
5 changed files with 53 additions and 21 deletions

View file

@ -7,6 +7,27 @@ export default class thesis extends Handler {
beforeParsed(content){
console.log("Thesis ------- ");
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');
}
});
}