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:
parent
85f05f82d0
commit
3c54fd7778
1 changed files with 18 additions and 7 deletions
|
@ -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(")")) {
|
||||
|
|
Loading…
Reference in a new issue