Rename once again, and use short instead for short descriptions of notes

This commit is contained in:
Veronica Berglyd Olsen
2023-11-26 13:58:00 +01:00
parent f919149c58
commit b9b4969b85
22 changed files with 73 additions and 67 deletions
+8 -8
View File
@@ -1280,14 +1280,14 @@ def testCoreIndex_processComment():
assert processComment("% \t SYNOPSIS : Hi") == (nwComment.SYNOPSIS, "Hi", 16)
assert processComment("% \t SYNOPSIS : Hi:You") == (nwComment.SYNOPSIS, "Hi:You", 16)
# Summary
assert processComment("%summary:") == (nwComment.PLAIN, "summary:", 0)
assert processComment("%summary: Hi") == (nwComment.SUMMARY, "Hi", 9)
assert processComment("% summary: Hi") == (nwComment.SUMMARY, "Hi", 10)
assert processComment("% summary : Hi") == (nwComment.SUMMARY, "Hi", 12)
assert processComment("% Summary : Hi") == (nwComment.SUMMARY, "Hi", 14)
assert processComment("% \t SUMMARY : Hi") == (nwComment.SUMMARY, "Hi", 15)
assert processComment("% \t SUMMARY : Hi:You") == (nwComment.SUMMARY, "Hi:You", 15)
# Short Description
assert processComment("%short:") == (nwComment.PLAIN, "short:", 0)
assert processComment("%short: Hi") == (nwComment.SHORT, "Hi", 7)
assert processComment("% short: Hi") == (nwComment.SHORT, "Hi", 8)
assert processComment("% short : Hi") == (nwComment.SHORT, "Hi", 10)
assert processComment("% Short : Hi") == (nwComment.SHORT, "Hi", 12)
assert processComment("% \t SHORT : Hi") == (nwComment.SHORT, "Hi", 13)
assert processComment("% \t SHORT : Hi:You") == (nwComment.SHORT, "Hi:You", 13)
# END Test testCoreIndex_processComment
+7 -7
View File
@@ -149,7 +149,7 @@ def testCoreToHtml_ConvertFormat(mockGUI):
"<p class='break'>Line one<br/>Line two<br/>Line three</p>\n"
)
# Synopsis, Summary
# Synopsis, Short
html._text = "%synopsis: The synopsis ...\n"
html.tokenizeText()
html.doConvert()
@@ -164,11 +164,11 @@ def testCoreToHtml_ConvertFormat(mockGUI):
)
html.setSynopsis(True)
html._text = "%summary: A description ...\n"
html._text = "%short: A short description ...\n"
html.tokenizeText()
html.doConvert()
assert html.theResult == (
"<p class='synopsis'><strong>Summary:</strong> A description ...</p>\n"
"<p class='synopsis'><strong>Short Description:</strong> A short description ...</p>\n"
)
# Comment
@@ -621,8 +621,8 @@ def testCoreToHtml_Format(mockGUI):
assert html._formatSynopsis("synopsis text", True) == (
"<p class='synopsis'><strong>Synopsis:</strong> synopsis text</p>\n"
)
assert html._formatSynopsis("summary text", False) == (
"<p class='synopsis'><strong>Summary:</strong> summary text</p>\n"
assert html._formatSynopsis("short text", False) == (
"<p class='synopsis'><strong>Short Description:</strong> short text</p>\n"
)
assert html._formatComments("comment text") == (
"<p class='comment'><strong>Comment:</strong> comment text</p>\n"
@@ -646,8 +646,8 @@ def testCoreToHtml_Format(mockGUI):
assert html._formatSynopsis("synopsis text", True) == (
"<p class='comment'><span class='synopsis'>Synopsis:</span> synopsis text</p>\n"
)
assert html._formatSynopsis("summary text", False) == (
"<p class='comment'><span class='synopsis'>Summary:</span> summary text</p>\n"
assert html._formatSynopsis("short text", False) == (
"<p class='comment'><span class='synopsis'>Short Description:</span> short text</p>\n"
)
assert html._formatComments("comment text") == (
"<p class='comment'>comment text</p>\n"
+4 -4
View File
@@ -471,19 +471,19 @@ def testCoreToken_MetaFormat(mockGUI):
tokens.tokenizeText()
assert tokens.theMarkdown[-1] == "% synopsis: The synopsis\n\n"
# Summary
# Short
tokens.setSynopsis(False)
tokens._text = "% summary: A description\n"
tokens._text = "% short: A short description\n"
tokens.tokenizeText()
assert tokens._tokens == [
(Tokenizer.T_SUMMARY, 0, "A description", None, Tokenizer.A_NONE),
(Tokenizer.T_SHORT, 0, "A short description", None, Tokenizer.A_NONE),
(Tokenizer.T_EMPTY, 0, "", None, Tokenizer.A_NONE),
]
assert tokens.theMarkdown[-1] == "\n"
tokens.setSynopsis(True)
tokens.tokenizeText()
assert tokens.theMarkdown[-1] == "% summary: A description\n\n"
assert tokens.theMarkdown[-1] == "% short: A short description\n\n"
# Keyword
tokens._text = "@char: Bod\n"
+3 -3
View File
@@ -106,7 +106,7 @@ def testCoreToMarkdown_ConvertFormat(mockGUI):
theMD.doConvert()
assert theMD.theResult == "Line one \nLine two \nLine three\n\n"
# Synopsis, Summary
# Synopsis, Short
theMD._text = "%synopsis: The synopsis ...\n"
theMD.tokenizeText()
theMD.doConvert()
@@ -119,10 +119,10 @@ def testCoreToMarkdown_ConvertFormat(mockGUI):
assert theMD.theResult == "**Synopsis:** The synopsis ...\n\n"
theMD.setSynopsis(True)
theMD._text = "%summary: A description ...\n"
theMD._text = "%short: A description ...\n"
theMD.tokenizeText()
theMD.doConvert()
assert theMD.theResult == "**Summary:** A description ...\n\n"
assert theMD.theResult == "**Short Description:** A description ...\n\n"
# Comment
theMD._text = "% A comment ...\n"
+5 -5
View File
@@ -447,12 +447,12 @@ def testCoreToOdt_Convert(mockGUI):
'</office:text>'
)
# Synopsis, Summary, Comment, Keywords
# Synopsis, Short, Comment, Keywords
odt._text = (
"### Scene\n\n"
"@pov: Jane\n\n"
"% synopsis: So it begins\n\n"
"% summary: Then what\n\n"
"% short: Then what\n\n"
"% A plain comment\n\n"
)
odt.setSynopsis(True)
@@ -471,7 +471,7 @@ def testCoreToOdt_Convert(mockGUI):
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
'Synopsis:</text:span> So it begins</text:p>'
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
'Summary:</text:span> Then what</text:p>'
'Short Description:</text:span> Then what</text:p>'
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
'Comment:</text:span> A plain comment</text:p>'
'</office:text>'
@@ -810,8 +810,8 @@ def testCoreToOdt_Format(mockGUI):
assert odt._formatSynopsis("synopsis text", True) == (
"Synopsis: synopsis text", [(0, ToOdt.FMT_B_B), (9, ToOdt.FMT_B_E)]
)
assert odt._formatSynopsis("summary text", False) == (
"Summary: summary text", [(0, ToOdt.FMT_B_B), (8, ToOdt.FMT_B_E)]
assert odt._formatSynopsis("short text", False) == (
"Short Description: short text", [(0, ToOdt.FMT_B_B), (18, ToOdt.FMT_B_E)]
)
assert odt._formatComments("comment text") == (
"Comment: comment text", [(0, ToOdt.FMT_B_B), (8, ToOdt.FMT_B_E)]
+2 -2
View File
@@ -594,8 +594,8 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockRnd):
assert nwGUI.docEditor.getText() == "Stuff\n% Synopsis: \n"
nwGUI.docEditor.setPlainText("Stuff\n")
nwGUI.mainMenu.aInsSummary.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == "Stuff\n% Summary: \n"
nwGUI.mainMenu.aInsShort.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == "Stuff\n% Short: \n"
# Insert Break or Space
# =====================