Fix regexes to be exclusive for 1, 2 and 3 stars
This commit is contained in:
+2
-2
@@ -121,8 +121,8 @@ class ToHtml(Tokenizer):
|
||||
self.FMT_B_E : "</strong>",
|
||||
self.FMT_I_B : "<em>",
|
||||
self.FMT_I_E : "</em>",
|
||||
self.FMT_U_B : "<u>",
|
||||
self.FMT_U_E : "</u>",
|
||||
self.FMT_S_B : "<strong><em>",
|
||||
self.FMT_S_E : "</em></strong>",
|
||||
}
|
||||
|
||||
if self.isNovel and self.genMode != self.M_PREVIEW:
|
||||
|
||||
@@ -44,8 +44,8 @@ class Tokenizer():
|
||||
FMT_B_E = 2 # End bold
|
||||
FMT_I_B = 3 # Begin italics
|
||||
FMT_I_E = 4 # End italics
|
||||
FMT_U_B = 5 # Begin underline
|
||||
FMT_U_E = 6 # End underline
|
||||
FMT_S_B = 5 # Begin bold italic
|
||||
FMT_S_E = 6 # End bold italic
|
||||
|
||||
T_EMPTY = 1 # Empty line (new paragraph)
|
||||
T_SYNOPSIS = 2 # Synopsis comment
|
||||
@@ -300,14 +300,14 @@ class Tokenizer():
|
||||
# RegExes for adding formatting tags within text lines
|
||||
# Keep in sync with the DocHighlighter class
|
||||
rxFormats = [(
|
||||
QRegularExpression(r"(?<![\w|\\])([\*]{2})(?!\s)(?m:(.+?))(?<![\s|\\])(\1)(?!\w)"),
|
||||
QRegularExpression(r"(?<![\w|\*|\\])([\*]{3})(?!\s|\*)(.+?)(?<![\s|\\])(\1)(?!\w)"),
|
||||
[None, self.FMT_S_B, None, self.FMT_S_E]
|
||||
),(
|
||||
QRegularExpression(r"(?<![\w|\*|\\])([\*]{2})(?!\s|\*)(.+?)(?<![\s|\\])(\1)(?!\w)"),
|
||||
[None, self.FMT_B_B, None, self.FMT_B_E]
|
||||
),(
|
||||
QRegularExpression(r"(?<![\w|_|\\])([_])(?!\s|\1)(?m:(.+?))(?<![\s|\\])(\1)(?!\w)"),
|
||||
QRegularExpression(r"(?<![\w|\*|\\])([\*])(?!\s|\1)(.+?)(?<![\s|\\])(\1)(?!\w)"),
|
||||
[None, self.FMT_I_B, None, self.FMT_I_E]
|
||||
),(
|
||||
QRegularExpression(r"(?<![\w|\\])([_]{2})(?!\s)(?m:(.+?))(?<![\s|\\])(\1)(?!\w)"),
|
||||
[None, self.FMT_U_B, None, self.FMT_U_E]
|
||||
)]
|
||||
|
||||
self.theTokens = []
|
||||
|
||||
@@ -140,21 +140,21 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
|
||||
# Markdown
|
||||
self.hRules.append((
|
||||
r"(?<![\w|\\])([\*]{1})(?!\s)(?m:(.+?))(?<![\s|\\])(\1)(?!\w)", {
|
||||
r"(?<![\w|\*|\\])([\*])(?!\s|\1)(.+?)(?<![\s|\\])(\1)(?!\w)", {
|
||||
1 : self.hStyles["hidden"],
|
||||
2 : self.hStyles["italic"],
|
||||
3 : self.hStyles["hidden"],
|
||||
}
|
||||
))
|
||||
self.hRules.append((
|
||||
r"(?<![\w|\\])([\*]{2})(?!\s)(?m:(.+?))(?<![\s|\\])(\1)(?!\w)", {
|
||||
r"(?<![\w|\*|\\])([\*]{2})(?!\s|\*)(.+?)(?<![\s|\\])(\1)(?!\w)", {
|
||||
1 : self.hStyles["hidden"],
|
||||
2 : self.hStyles["bold"],
|
||||
3 : self.hStyles["hidden"],
|
||||
}
|
||||
))
|
||||
self.hRules.append((
|
||||
r"(?<![\w|\\])([\*]{3})(?!\s)(?m:(.+?))(?<![\s|\\])(\1)(?!\w)", {
|
||||
r"(?<![\w|\*|\\])([\*]{3})(?!\s|\*)(.+?)(?<![\s|\\])(\1)(?!\w)", {
|
||||
1 : self.hStyles["hidden"],
|
||||
2 : self.hStyles["bolditalic"],
|
||||
3 : self.hStyles["hidden"],
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.9.0rc1" hexVersion="0x000900c1" fileVersion="1.1" timeStamp="2020-06-12 22:46:53">
|
||||
<novelWriterXML appVersion="0.9.0rc1" hexVersion="0x000900c1" fileVersion="1.1" timeStamp="2020-06-12 23:58:07">
|
||||
<project>
|
||||
<name>Sample Project</name>
|
||||
<title>Sample Project</title>
|
||||
<author>Jane Smith</author>
|
||||
<author>Jay Doh</author>
|
||||
<saveCount>313</saveCount>
|
||||
<autoCount>47</autoCount>
|
||||
<editTime>5934</editTime>
|
||||
<saveCount>319</saveCount>
|
||||
<autoCount>49</autoCount>
|
||||
<editTime>9675</editTime>
|
||||
</project>
|
||||
<settings>
|
||||
<doBackup>False</doBackup>
|
||||
<spellCheck>True</spellCheck>
|
||||
<autoOutline>True</autoOutline>
|
||||
<lastEdited>636b6aa9b697b</lastEdited>
|
||||
<lastViewed>14298de4d9524</lastViewed>
|
||||
<lastViewed>636b6aa9b697b</lastViewed>
|
||||
<lastWordCount>921</lastWordCount>
|
||||
<autoReplace>
|
||||
<A>B</A>
|
||||
@@ -117,7 +117,7 @@
|
||||
<charCount>1202</charCount>
|
||||
<wordCount>217</wordCount>
|
||||
<paraCount>7</paraCount>
|
||||
<cursorPos>469</cursorPos>
|
||||
<cursorPos>248</cursorPos>
|
||||
</item>
|
||||
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
|
||||
<name>Another Scene</name>
|
||||
|
||||
Reference in New Issue
Block a user