you can add words to the stoplist for h ighlighting now. wow. that took way longer than it should've.

This commit is contained in:
bingus_violet 2024-12-05 01:13:15 -06:00
parent 85f05f82d0
commit 3c54fd7778

View file

@ -146,23 +146,34 @@ function highlighter(json, full = true, linkParent = false) {
var termKey = "{TERM" + index + "}"
var termProps = dict
while (element.content.includes(termKey)) {
var endRegex = " "
var endCharacters = [" ", "&"]
var termIndex = element.content.indexOf(termKey)
var spanEnd = element.content.indexOf(endRegex, termIndex)
var spanEnd = element.content.length
if (spanEnd == -1) {
spanEnd = element.content.length
}
endCharacters.forEach((char) => {
var end = element.content.indexOf(char, termIndex)
if (end < spanEnd && end != -1) {
spanEnd = end
}
})
var spanStart = element.content.substring(0, termIndex).lastIndexOf(endRegex) + 1
var spanStart = 0
endCharacters.forEach((char) => {
var start = element.content.substring(0, termIndex).lastIndexOf(char) + 1
if (spanStart < start) {
spanStart = start
}
})
// if (highTable[index] == "ULTRAKILL") {
// console.log(startContent, " ---- ", endContent)
// }
var startContent = element.content.substring(spanStart - 1, termIndex)
var startContent = element.content.substring(spanStart, termIndex)
var endContent = element.content.substring(termIndex + termKey.length, spanEnd)
if (startContent.includes("(") && !endContent.includes(")")) {