Add regexes and highlighting for in-line commands

This commit is contained in:
Veronica Berglyd Olsen
2023-10-20 00:04:23 +02:00
parent bd6e666fdc
commit ef4277437b
4 changed files with 21 additions and 9 deletions
+9 -1
View File
@@ -59,7 +59,15 @@ class nwRegEx:
FMT_EI = r"(?<![\w\\])(_)(?![\s_])(.+?)(?<![\s\\])(\1)(?!\w)"
FMT_EB = r"(?<![\w\\])([\*]{2})(?![\s\*])(.+?)(?<![\s\\])(\1)(?!\w)"
FMT_ST = r"(?<![\w\\])([~]{2})(?![\s~])(.+?)(?<![\s\\])(\1)(?!\w)"
FMT_IN = r"(?<![\\])(\[[\^_])(.+?)(?<![\\])(\])"
FMT_IN = r"(?<![\\])(\[)(b|i|u|s|sup|sub)(:)(.+?)(?<![\\])(\])"
# Format breakdown of inline codes from FMT_IN
INL_EI = r"(?<![\\])(\[i:)(.+?)(?<![\\])(\])"
INL_EB = r"(?<![\\])(\[b:)(.+?)(?<![\\])(\])"
INL_ST = r"(?<![\\])(\[s:)(.+?)(?<![\\])(\])"
INL_UN = r"(?<![\\])(\[u:)(.+?)(?<![\\])(\])"
INL_UP = r"(?<![\\])(\[sup:)(.+?)(?<![\\])(\])"
INL_DN = r"(?<![\\])(\[sub:)(.+?)(?<![\\])(\])"
# END Class nwRegEx
+3 -1
View File
@@ -209,8 +209,10 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self._hRules.append((
nwRegEx.FMT_IN, {
1: self._hStyles["keyword"],
2: self._hStyles["codevalue"],
2: self._hStyles["keyword"],
3: self._hStyles["keyword"],
4: self._hStyles["codevalue"],
5: self._hStyles["keyword"],
}
))