add intro and chapter wrapper

This commit is contained in:
Julie Blanc 2026-04-21 13:52:57 +02:00
parent 92b92a1146
commit 07047d97ea
8 changed files with 130 additions and 55 deletions

View file

@ -7,26 +7,7 @@ export default class thesis extends Handler {
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');
}
});
}