thesis script
This commit is contained in:
parent
dcdd26de82
commit
5715733a40
5 changed files with 53 additions and 21 deletions
21
js/these.js
21
js/these.js
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue