Skip to content

Commit 4b10a01

Browse files
authored
Fix color lookahead
1 parent 931d675 commit 4b10a01

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

script.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ def parse_text(text: str) -> str:
6060
)
6161
# '\c[x]': color, accepts RBYGPMOASV, W white, X black, 0 reset
6262
text = re.sub(
63-
r'\\c(.)(.*?)(?=\\\\c|$)',
63+
r'\\c(.)(.*?)(?=\\c|$)',
6464
r'<span class="cc-color cc-\1">\2</span>',
6565
text,
6666
)
6767
# '\[x]': Undertale color, accepts RGYBOLPp, same W and X
6868
text = re.sub(
69-
r'\\([RGYBOLPpWX])(.*?)(?=\\\\c|$)',
69+
r'\\([RGYBOLPpWX])(.*?)(?=\\[RGYBOLPpWX]|$)',
7070
r'<span class="cc-color cc-\1">\2</span>',
7171
text,
7272
)

0 commit comments

Comments
 (0)