Fix highlighting of multiple dialogue sections

This commit is contained in:
Veronica Berglyd Olsen
2024-06-10 23:50:59 +02:00
parent 0b3488c265
commit 416c580a45
3 changed files with 129 additions and 68 deletions
+1 -1
View File
@@ -457,7 +457,7 @@ class ToHtml(Tokenizer):
else:
html = "<sup>ERR</sup>"
else:
html = HTML5_TAGS.get(fmt, "ERR")
html = HTML5_TAGS.get(fmt, "")
temp = f"{temp[:pos]}{html}{temp[pos:]}"
temp = temp.replace("\n", "<br>")
return stripEscape(temp)
+3 -1
View File
@@ -1139,7 +1139,9 @@ class Tokenizer(ABC):
# Match Dialogue
if self._rxDialogue:
for regEx, fmtB, fmtE in self._rxDialogue:
if (rxMatch := regEx.match(text, 0)).hasMatch():
rxItt = regEx.globalMatch(text, 0)
while rxItt.hasNext():
rxMatch = rxItt.next()
temp.append((rxMatch.capturedStart(0), 0, fmtB, ""))
temp.append((rxMatch.capturedEnd(0), 0, fmtE, ""))