Loosened the restriction on the synopsis tag a bit

This commit is contained in:
Veronica K. B. Olsen
2020-04-26 18:06:57 +02:00
parent 946331145f
commit c934532ea2
4 changed files with 19 additions and 10 deletions
+8 -4
View File
@@ -267,11 +267,15 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.setFormat(4, len(theText), self.hStyles["header4"])
elif theText.startswith("%"): # Comments
if theText.startswith("%synopsis:"):
self.setFormat(0, 10, self.hStyles["modifier"])
self.setFormat(10, len(theText), self.hStyles["hidden"])
toCheck = theText[1:].lstrip().lower()
tLen = len(theText)
cLen = len(toCheck)
cOff = tLen - cLen
if toCheck.startswith("synopsis:"):
self.setFormat(0, cOff+9, self.hStyles["modifier"])
self.setFormat(cOff+9, tLen, self.hStyles["hidden"])
else:
self.setFormat(0, len(theText), self.hStyles["hidden"])
self.setFormat(0, tLen, self.hStyles["hidden"])
else: # Text Paragraph
for rX, xFmt in self.rxRules:
+7 -2
View File
@@ -308,9 +308,14 @@ class NWIndex():
self.indexNoteRef(tHandle, aLine, nLine, nTitle)
self.indexTag(tHandle, aLine, nLine, itemClass)
elif aLine.startswith(r"%synopsis:"):
elif aLine.startswith(r"%"):
if nTitle > 0:
self.indexSynopsis(tHandle, isNovel, aLine[10:].strip(), nTitle)
toCheck = aLine[1:].lstrip().lower()
tLen = len(aLine)
cLen = len(toCheck)
cOff = tLen - cLen
if toCheck.startswith("synopsis:"):
self.indexSynopsis(tHandle, isNovel, aLine[cOff+9:].strip(), nTitle)
# Count words for remaining text after last heading
if nTitle > 0:
@@ -3,5 +3,5 @@
@pov: Jane
@location: Earth
%synopsis: We can add a chapter file, but keep the scene files separate. In the chapter file we can set the meta data that applies to the whole chapter if we wish to.
% Synopsis: We can add a chapter file, but keep the scene files separate. In the chapter file we can set the meta data that applies to the whole chapter if we wish to.
+3 -3
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="38" autoCount="8" timeStamp="2020-04-13 16:55:55">
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="52" autoCount="8" timeStamp="2020-04-26 18:05:45">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -71,7 +71,7 @@
<charCount>12</charCount>
<wordCount>3</wordCount>
<paraCount>0</paraCount>
<cursorPos>214</cursorPos>
<cursorPos>215</cursorPos>
</item>
<item handle="636b6aa9b697b" order="1" parent="e7ded148d6e4a">
<name>Making a Scene</name>
@@ -83,7 +83,7 @@
<charCount>1199</charCount>
<wordCount>216</wordCount>
<paraCount>7</paraCount>
<cursorPos>19</cursorPos>
<cursorPos>950</cursorPos>
</item>
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
<name>Another Scene</name>