Add processing of story structure comments in the build tool
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
"Short Description": "Short Description",
|
||||
"Footnotes": "Footnotes",
|
||||
"Comment": "Comment",
|
||||
"Story Structure": "Story Structure",
|
||||
"Notes": "Notes",
|
||||
"Tag": "Tag",
|
||||
"Point of View": "Point of View",
|
||||
|
||||
@@ -64,12 +64,12 @@ class ComStyle(NamedTuple):
|
||||
COMMENT_STYLE = {
|
||||
nwComment.PLAIN: ComStyle("Comment", "comment", "comment"),
|
||||
nwComment.IGNORE: ComStyle(),
|
||||
nwComment.SYNOPSIS: ComStyle("Synopsis", "modifier", "synopsis"),
|
||||
nwComment.SHORT: ComStyle("Short Description", "modifier", "synopsis"),
|
||||
nwComment.SYNOPSIS: ComStyle("Synopsis", "modifier", "note"),
|
||||
nwComment.SHORT: ComStyle("Short Description", "modifier", "note"),
|
||||
nwComment.NOTE: ComStyle("Note", "modifier", "note"),
|
||||
nwComment.FOOTNOTE: ComStyle("", "modifier", "note"),
|
||||
nwComment.COMMENT: ComStyle(),
|
||||
nwComment.STORY: ComStyle("", "modifier", "note"),
|
||||
nwComment.STORY: ComStyle("Story Structure", "modifier", "note"),
|
||||
}
|
||||
HEADINGS = [
|
||||
BlockTyp.TITLE, BlockTyp.PART, BlockTyp.HEAD1,
|
||||
@@ -440,7 +440,7 @@ class Tokenizer(ABC):
|
||||
def initDocument(self) -> None:
|
||||
"""Initialise data after settings."""
|
||||
self._classes["modifier"] = self._theme.modifier
|
||||
self._classes["synopsis"] = self._theme.note
|
||||
self._classes["note"] = self._theme.note
|
||||
self._classes["comment"] = self._theme.comment
|
||||
self._classes["dialog"] = self._theme.dialog
|
||||
self._classes["altdialog"] = self._theme.altdialog
|
||||
@@ -615,7 +615,9 @@ class Tokenizer(ABC):
|
||||
if doJustify and not tStyle & BlockFmt.ALIGNED:
|
||||
tStyle |= BlockFmt.JUSTIFY
|
||||
|
||||
if cStyle in (nwComment.SYNOPSIS, nwComment.SHORT, nwComment.PLAIN):
|
||||
if cStyle in (
|
||||
nwComment.SYNOPSIS, nwComment.SHORT, nwComment.PLAIN, nwComment.STORY
|
||||
):
|
||||
bStyle = COMMENT_STYLE[cStyle]
|
||||
tLine, tFmt = self._formatComment(bStyle, cKey, cText)
|
||||
tBlocks.append((
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
%%~name: Making a Scene
|
||||
%%~path: 6a2d6d5f4f401/636b6aa9b697b
|
||||
%%~kind: NOVEL/DOCUMENT
|
||||
%%~hash: 8d245fa740926779d19741ff7f75ef387b55130c
|
||||
%%~date: Unknown/2024-10-25 23:54:52
|
||||
%%~hash: c057a5e9309b0e764c367b0fe9ab0607e3308622
|
||||
%%~date: Unknown/2025-04-08 20:10:33
|
||||
### Making a Scene
|
||||
|
||||
@pov: Jane
|
||||
@@ -10,6 +10,8 @@
|
||||
@location: Earth
|
||||
@mention: Space
|
||||
|
||||
%Story.Resolution: You can describe the scene structure with story comments.
|
||||
|
||||
A scene is defined by a level three heading, like the one at the top of this page. The scene will be assigned to the chapter preceding it in the project tree. The scene document can be sorted after the chapter document, or as a child of the chapter. Both result in the same output in the end, so it is a matter of preference.
|
||||
|
||||
Each paragraph in the scene is separated by a blank line. The text supports minimal formatting, like **bold**, _italic_ and **_bold italic_**. You can also ~~strike through~~ text. There is **some support for _nested_ emphasis**, but there are some known limitations. If the syntax highlighter doesn’t show it correctly, the export tool will not either.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="2.7a3" hexVersion="0x020700a3" fileVersion="1.5" fileRevision="4" timeStamp="2025-03-23 22:26:31">
|
||||
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="2166" autoCount="282" editTime="96058">
|
||||
<novelWriterXML appVersion="2.7a3" hexVersion="0x020700a3" fileVersion="1.5" fileRevision="4" timeStamp="2025-04-08 20:12:28">
|
||||
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="2176" autoCount="285" editTime="96579">
|
||||
<name>Sample Project</name>
|
||||
<author>Jane Smith</author>
|
||||
</project>
|
||||
@@ -58,7 +58,7 @@
|
||||
<name status="sf24ce6" import="ia857f0" active="yes">Chapter One</name>
|
||||
</item>
|
||||
<item handle="636b6aa9b697b" parent="6a2d6d5f4f401" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||
<meta expanded="no" heading="H3" charCount="2999" wordCount="530" paraCount="16" cursorPos="1035" />
|
||||
<meta expanded="no" heading="H3" charCount="2999" wordCount="530" paraCount="16" cursorPos="159" />
|
||||
<name status="s90e6c9" import="ia857f0" active="yes">Making a Scene</name>
|
||||
</item>
|
||||
<item handle="bc0cbd2a407f3" parent="6a2d6d5f4f401" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||
|
||||
@@ -785,7 +785,7 @@ def testFmtToken_MetaFormat(mockGUI):
|
||||
BlockTyp.COMMENT, "", "Synopsis: The synopsis", [
|
||||
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
|
||||
(9, TextFmt.COL_E, ""), (9, TextFmt.B_E, ""),
|
||||
(10, TextFmt.COL_B, "synopsis"), (22, TextFmt.COL_E, "")
|
||||
(10, TextFmt.COL_B, "note"), (22, TextFmt.COL_E, "")
|
||||
], BlockFmt.NONE
|
||||
)]
|
||||
|
||||
@@ -802,7 +802,7 @@ def testFmtToken_MetaFormat(mockGUI):
|
||||
BlockTyp.COMMENT, "", "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, "synopsis"), (38, TextFmt.COL_E, ""),
|
||||
(19, TextFmt.COL_B, "note"), (38, TextFmt.COL_E, ""),
|
||||
], BlockFmt.NONE
|
||||
)]
|
||||
|
||||
@@ -1553,7 +1553,7 @@ def testFmtToken_TextIndent(mockGUI):
|
||||
tokens.tokenizeText()
|
||||
tFmt = [
|
||||
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"), (9, TextFmt.COL_E, ""),
|
||||
(9, TextFmt.B_E, ""), (10, TextFmt.COL_B, "synopsis"), (24, TextFmt.COL_E, ""),
|
||||
(9, TextFmt.B_E, ""), (10, TextFmt.COL_B, "note"), (24, TextFmt.COL_E, ""),
|
||||
]
|
||||
assert tokens._blocks == [
|
||||
(BlockTyp.HEAD3, TM1, "Scene Two", [], BlockFmt.NONE),
|
||||
@@ -1814,7 +1814,7 @@ def testFmtToken_FormatComment(mockGUI):
|
||||
"Synopsis: Hello world!", [
|
||||
(0, TextFmt.B_B, ""), (0, TextFmt.COL_B, "modifier"),
|
||||
(9, TextFmt.COL_E, ""), (9, TextFmt.B_E, ""),
|
||||
(10, TextFmt.COL_B, "synopsis"), (22, TextFmt.COL_E, ""),
|
||||
(10, TextFmt.COL_B, "note"), (22, TextFmt.COL_E, ""),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user