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
+2 -2
View File
@@ -406,7 +406,7 @@ class ProjectBuilder:
chSynop = self.tr("Summary of the chapter.")
scSynop = self.tr("Summary of the scene.")
bfNote = self.tr("A brief description.")
bfNote = self.tr("A short description.")
# Create chapters
if numChapters > 0:
@@ -450,7 +450,7 @@ class ProjectBuilder:
aDoc.writeDocument(
f"# {noteTitles[newRoot]}\n\n"
f"@tag: {ntTag}\n\n"
f"% Summary: {bfNote}\n\n"
f"% Short: {bfNote}\n\n"
)
# Also add the archive and trash folders
+2 -2
View File
@@ -339,7 +339,7 @@ class NWIndex:
elif line.startswith("%"):
if cTitle != TT_NONE:
cStyle, cText, _ = processComment(line)
if cStyle in (nwComment.SYNOPSIS, nwComment.SUMMARY):
if cStyle in (nwComment.SYNOPSIS, nwComment.SHORT):
self._itemIndex.setHeadingSynopsis(tHandle, cTitle, cText)
# Count words for remaining text after last heading
@@ -1268,7 +1268,7 @@ class IndexHeading:
# =============================================================================================== #
CLASSIFIERS = {
"summary": nwComment.SUMMARY,
"short": nwComment.SHORT,
"synopsis": nwComment.SYNOPSIS,
}
+5 -2
View File
@@ -289,7 +289,7 @@ class ToHtml(Tokenizer):
elif tType == self.T_SYNOPSIS and self._doSynopsis:
lines.append(self._formatSynopsis(tText, True))
elif tType == self.T_SUMMARY and self._doSynopsis:
elif tType == self.T_SHORT and self._doSynopsis:
lines.append(self._formatSynopsis(tText, False))
elif tType == self.T_COMMENT and self._doComments:
@@ -459,7 +459,10 @@ class ToHtml(Tokenizer):
def _formatSynopsis(self, text: str, synopsis: bool) -> str:
"""Apply HTML formatting to synopsis."""
sSynop = self._localLookup("Synopsis") if synopsis else self._localLookup("Summary")
if synopsis:
sSynop = self._localLookup("Synopsis")
else:
sSynop = self._localLookup("Short Description")
if self._genMode == self.M_PREVIEW:
return f"<p class='comment'><span class='synopsis'>{sSynop}:</span> {text}</p>\n"
else:
+3 -3
View File
@@ -80,7 +80,7 @@ class Tokenizer(ABC):
# Block Type
T_EMPTY = 1 # Empty line (new paragraph)
T_SYNOPSIS = 2 # Synopsis comment
T_SUMMARY = 3 # Summary comment
T_SHORT = 3 # Short description comment
T_COMMENT = 4 # Comment line
T_KEYWORD = 5 # Command line
T_TITLE = 6 # Title
@@ -470,9 +470,9 @@ class Tokenizer(ABC):
))
if self._doSynopsis and self._keepMarkdown:
tmpMarkdown.append("%s\n" % aLine)
elif cStyle == nwComment.SUMMARY:
elif cStyle == nwComment.SHORT:
self._tokens.append((
self.T_SUMMARY, nHead, cText, None, sAlign
self.T_SHORT, nHead, cText, None, sAlign
))
if self._doSynopsis and self._keepMarkdown:
tmpMarkdown.append("%s\n" % aLine)
+2 -2
View File
@@ -170,8 +170,8 @@ class ToMarkdown(Tokenizer):
label = self._localLookup("Synopsis")
lines.append(f"**{label}:** {tText}\n\n")
elif tType == self.T_SUMMARY and self._doSynopsis:
label = self._localLookup("Summary")
elif tType == self.T_SHORT and self._doSynopsis:
label = self._localLookup("Short Description")
lines.append(f"**{label}:** {tText}\n\n")
elif tType == self.T_COMMENT and self._doComments:
+5 -2
View File
@@ -484,7 +484,7 @@ class ToOdt(Tokenizer):
tTemp, fTemp = self._formatSynopsis(tText, True)
self._addTextPar("Text_20_Meta", oStyle, tTemp, tFmt=fTemp)
elif tType == self.T_SUMMARY and self._doSynopsis:
elif tType == self.T_SHORT and self._doSynopsis:
tTemp, fTemp = self._formatSynopsis(tText, False)
self._addTextPar("Text_20_Meta", oStyle, tTemp, tFmt=fTemp)
@@ -558,7 +558,10 @@ class ToOdt(Tokenizer):
def _formatSynopsis(self, text: str, synopsis: bool) -> tuple[str, list[tuple[int, int]]]:
"""Apply formatting to synopsis lines."""
name = self._localLookup("Synopsis") if synopsis else self._localLookup("Summary")
if synopsis:
name = self._localLookup("Synopsis")
else:
name = self._localLookup("Short Description")
rTxt = f"{name}: {text}"
rFmt = [(0, self.FMT_B_B), (len(name) + 1, self.FMT_B_E)]
return rTxt, rFmt