Merge 2.7.2 into main

This commit is contained in:
Veronica Berglyd Olsen
2025-06-24 17:12:43 +02:00
169 changed files with 5023 additions and 2580 deletions
+47 -3
View File
@@ -783,7 +783,7 @@ def testFmtToken_MetaFormat(mockGUI):
tokens._text = "% synopsis: The synopsis\n"
tokens.tokenizeText()
assert tokens._blocks == [(
BlockTyp.COMMENT, "", "Synopsis: The synopsis", [
BlockTyp.SUMMARY, "", "Synopsis: The synopsis", [
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
(9, TextFmt.COL_E, ""), (9, TextFmt.B_E, ""),
(10, TextFmt.COL_B, "note"), (22, TextFmt.COL_E, "")
@@ -800,13 +800,52 @@ def testFmtToken_MetaFormat(mockGUI):
tokens._text = "% short: A short description\n"
tokens.tokenizeText()
assert tokens._blocks == [(
BlockTyp.COMMENT, "", "Short Description: A short description", [
BlockTyp.SUMMARY, "", "Short Description: A short description", [
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
(18, TextFmt.COL_E, ""), (18, TextFmt.B_E, ""),
(19, TextFmt.COL_B, "note"), (38, TextFmt.COL_E, ""),
], BlockFmt.NONE
)]
# Story Comments
tokens.setCommentType(nwComment.STORY, False)
tokens.setCommentType(nwComment.NOTE, False)
tokens._text = (
"%Story.Stuff: Stuff happens\n"
"%Note.More: That stuff that happened\n"
"%Note.Other: That other stuff that happened\n"
)
tokens.tokenizeText()
assert tokens._blocks == []
tokens.setCommentType(nwComment.STORY, True)
tokens.setCommentType(nwComment.NOTE, True)
tokens._text = (
"%Story.Stuff: Stuff happens\n"
"%Note.More: That stuff that happened\n"
"%Note.Other: That other stuff that happened\n"
)
tokens.tokenizeText()
assert tokens._blocks == [(
BlockTyp.NOTE, "", "Story Structure (Stuff): Stuff happens", [
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
(24, TextFmt.COL_E, ""), (24, TextFmt.B_E, ""),
(25, TextFmt.COL_B, "note"), (38, TextFmt.COL_E, "")
], BlockFmt.Z_BTM
), (
BlockTyp.NOTE, "", "Note (More): That stuff that happened", [
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
(12, TextFmt.COL_E, ""), (12, TextFmt.B_E, ""),
(13, TextFmt.COL_B, "note"), (37, TextFmt.COL_E, "")
], BlockFmt.Z_TOP | BlockFmt.Z_BTM
), (
BlockTyp.NOTE, "", "Note (Other): That other stuff that happened", [
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
(13, TextFmt.COL_E, ""), (13, TextFmt.B_E, ""),
(14, TextFmt.COL_B, "note"), (44, TextFmt.COL_E, "")
], BlockFmt.Z_TOP
)]
# Keyword
tokens.setKeywords(False)
tokens._text = "@char: Bod\n"
@@ -919,6 +958,11 @@ def testFmtToken_ExtractFormats(mockGUI):
assert text == "Text with strikethrough in it."
assert fmt == [(10, TextFmt.D_B, ""), (23, TextFmt.D_E, "")]
# Plain mark
text, fmt = tokens._extractFormats("Text with ==a highlight== in it.")
assert text == "Text with a highlight in it."
assert fmt == [(10, TextFmt.M_B, ""), (21, TextFmt.M_E, "")]
# Nested bold/italics
text, fmt = tokens._extractFormats("Text with **bold and _italics_** in it.")
assert text == "Text with bold and italics in it."
@@ -1632,7 +1676,7 @@ def testFmtToken_TextIndent(mockGUI):
]
assert tokens._blocks == [
(BlockTyp.HEAD3, TM1, "Scene Two", [], BlockFmt.NONE),
(BlockTyp.COMMENT, "", "Synopsis: Stuff happens.", tFmt, BlockFmt.NONE),
(BlockTyp.SUMMARY, "", "Synopsis: Stuff happens.", tFmt, BlockFmt.NONE),
]
assert tokens._noIndent is True