Add support for including notes in manuscript
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"Footnotes": "Footnotes",
|
||||
"Comment": "Comment",
|
||||
"Story Structure": "Story Structure",
|
||||
"Note": "Note",
|
||||
"Notes": "Notes",
|
||||
"Tag": "Tag",
|
||||
"Point of View": "Point of View",
|
||||
|
||||
@@ -79,6 +79,7 @@ SETTINGS_TEMPLATE: dict[str, tuple[type, T_BuildValue]] = {
|
||||
"text.includeSynopsis": (bool, False),
|
||||
"text.includeComments": (bool, False),
|
||||
"text.includeStory": (bool, False),
|
||||
"text.includeNotes": (bool, False),
|
||||
"text.includeKeywords": (bool, False),
|
||||
"text.includeBodyText": (bool, True),
|
||||
"text.ignoredKeywords": (str, ""),
|
||||
@@ -146,6 +147,7 @@ SETTINGS_LABELS = {
|
||||
"text.includeSynopsis": QT_TRANSLATE_NOOP("Builds", "Include Synopsis"),
|
||||
"text.includeComments": QT_TRANSLATE_NOOP("Builds", "Include Comments"),
|
||||
"text.includeStory": QT_TRANSLATE_NOOP("Builds", "Include Story Structure"),
|
||||
"text.includeNotes": QT_TRANSLATE_NOOP("Builds", "Include Notes"),
|
||||
"text.includeKeywords": QT_TRANSLATE_NOOP("Builds", "Include Keywords"),
|
||||
"text.includeBodyText": QT_TRANSLATE_NOOP("Builds", "Include Body Text"),
|
||||
"text.ignoredKeywords": QT_TRANSLATE_NOOP("Builds", "Ignore These Keywords"),
|
||||
|
||||
@@ -317,6 +317,7 @@ class NWBuildDocument:
|
||||
bldObj.setCommentType(nwComment.SYNOPSIS, self._build.getBool("text.includeSynopsis"))
|
||||
bldObj.setCommentType(nwComment.SHORT, self._build.getBool("text.includeSynopsis"))
|
||||
bldObj.setCommentType(nwComment.STORY, self._build.getBool("text.includeStory"))
|
||||
bldObj.setCommentType(nwComment.NOTE, self._build.getBool("text.includeNotes"))
|
||||
|
||||
if isinstance(bldObj, ToHtml):
|
||||
bldObj.setStyles(self._build.getBool("html.addStyles"))
|
||||
|
||||
@@ -614,7 +614,8 @@ class Tokenizer(ABC):
|
||||
tStyle |= BlockFmt.JUSTIFY
|
||||
|
||||
if cStyle in (
|
||||
nwComment.SYNOPSIS, nwComment.SHORT, nwComment.PLAIN, nwComment.STORY
|
||||
nwComment.SYNOPSIS, nwComment.SHORT, nwComment.PLAIN,
|
||||
nwComment.STORY, nwComment.NOTE,
|
||||
):
|
||||
bStyle = COMMENT_STYLE[cStyle]
|
||||
tLine, tFmt = self._formatComment(bStyle, cKey, cText)
|
||||
|
||||
@@ -751,9 +751,13 @@ class GuiOutlineTree(QTreeWidget):
|
||||
def _dumpNovelData(self, rootHandle: str | None) -> list[list[str | int]]:
|
||||
"""Dump all novel data into a table."""
|
||||
sLabel = SHARED.project.localLookup("Story Structure")
|
||||
nLabel = SHARED.project.localLookup("Note")
|
||||
sKeys = sorted(SHARED.project.index.getStoryKeys())
|
||||
nKeys = sorted(SHARED.project.index.getNoteKeys())
|
||||
sMatch = [f"story.{k}" for k in sKeys]
|
||||
nMatch = [f"note.{k}" for k in nKeys]
|
||||
sHeaders = [f"{sLabel} ({k})" for k in sKeys]
|
||||
nHeaders = [f"{nLabel} ({k})" for k in nKeys]
|
||||
|
||||
data: list[list[str | int]] = [[
|
||||
"H",
|
||||
@@ -777,6 +781,7 @@ class GuiOutlineTree(QTreeWidget):
|
||||
trConst(nwLabels.OUTLINE_COLS[nwOutline.MENTION]),
|
||||
trConst(nwLabels.OUTLINE_COLS[nwOutline.SYNOP]),
|
||||
*sHeaders,
|
||||
*nHeaders,
|
||||
]]
|
||||
|
||||
for _, tHandle, sTitle, novIdx in SHARED.project.index.novelStructure(
|
||||
@@ -786,6 +791,7 @@ class GuiOutlineTree(QTreeWidget):
|
||||
refs = SHARED.project.index.getReferences(tHandle, sTitle)
|
||||
comments = dict(novIdx.comments.items())
|
||||
story = [comments.get(k, "") for k in sMatch]
|
||||
notes = [comments.get(k, "") for k in nMatch]
|
||||
data.append([
|
||||
novIdx.level,
|
||||
novIdx.title,
|
||||
@@ -808,6 +814,7 @@ class GuiOutlineTree(QTreeWidget):
|
||||
", ".join(refs[nwKeyWords.MENTION_KEY]),
|
||||
novIdx.synopsis,
|
||||
*story,
|
||||
*notes,
|
||||
])
|
||||
|
||||
return data
|
||||
|
||||
@@ -630,7 +630,7 @@ class _DetailsWidget(QWidget):
|
||||
self.listView.addTopLevelItem(item)
|
||||
for key in [
|
||||
"text.includeSynopsis", "text.includeComments", "text.includeStory",
|
||||
"text.includeKeywords", "text.includeBodyText",
|
||||
"text.includeNotes", "text.includeKeywords", "text.includeBodyText",
|
||||
]:
|
||||
sub = QTreeWidgetItem()
|
||||
sub.setText(0, build.getLabel(key))
|
||||
|
||||
@@ -974,12 +974,14 @@ class _FormattingTab(NScrollableForm):
|
||||
self.incSynopsis = NSwitch(self, height=iPx)
|
||||
self.incComments = NSwitch(self, height=iPx)
|
||||
self.incStory = NSwitch(self, height=iPx)
|
||||
self.incNotes = NSwitch(self, height=iPx)
|
||||
self.incKeywords = NSwitch(self, height=iPx)
|
||||
|
||||
self.addRow(self._build.getLabel("text.includeBodyText"), self.incBodyText)
|
||||
self.addRow(self._build.getLabel("text.includeSynopsis"), self.incSynopsis)
|
||||
self.addRow(self._build.getLabel("text.includeComments"), self.incComments)
|
||||
self.addRow(self._build.getLabel("text.includeStory"), self.incStory)
|
||||
self.addRow(self._build.getLabel("text.includeNotes"), self.incNotes)
|
||||
self.addRow(self._build.getLabel("text.includeKeywords"), self.incKeywords)
|
||||
|
||||
# Ignored Keywords
|
||||
@@ -1288,6 +1290,7 @@ class _FormattingTab(NScrollableForm):
|
||||
self.incSynopsis.setChecked(self._build.getBool("text.includeSynopsis"))
|
||||
self.incComments.setChecked(self._build.getBool("text.includeComments"))
|
||||
self.incStory.setChecked(self._build.getBool("text.includeStory"))
|
||||
self.incNotes.setChecked(self._build.getBool("text.includeNotes"))
|
||||
self.incKeywords.setChecked(self._build.getBool("text.includeKeywords"))
|
||||
self.ignoredKeywords.setText(self._build.getStr("text.ignoredKeywords"))
|
||||
self.addNoteHead.setChecked(self._build.getBool("text.addNoteHeadings"))
|
||||
@@ -1387,6 +1390,7 @@ class _FormattingTab(NScrollableForm):
|
||||
self._build.setValue("text.includeSynopsis", self.incSynopsis.isChecked())
|
||||
self._build.setValue("text.includeComments", self.incComments.isChecked())
|
||||
self._build.setValue("text.includeStory", self.incStory.isChecked())
|
||||
self._build.setValue("text.includeNotes", self.incNotes.isChecked())
|
||||
self._build.setValue("text.includeKeywords", self.incKeywords.isChecked())
|
||||
self._build.setValue("text.ignoredKeywords", self.ignoredKeywords.text())
|
||||
self._build.setValue("text.addNoteHeadings", self.addNoteHead.isChecked())
|
||||
|
||||
Reference in New Issue
Block a user