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
+1 -1
View File
@@ -1,6 +1,6 @@
{
"Synopsis": "Synopsis",
"Summary": "Summary",
"Short Description": "Short Description",
"Comment": "Comment",
"Notes": "Notes",
"Tag": "Tag",
+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
+2 -2
View File
@@ -65,7 +65,7 @@ class nwComment(Enum):
PLAIN = 0
SYNOPSIS = 1
SUMMARY = 2
SHORT = 2
# END Enum nwComment
@@ -136,7 +136,7 @@ class nwDocInsert(Enum):
QUOTE_LD = 3
QUOTE_RD = 4
SYNOPSIS = 5
SUMMARY = 6
SHORT = 6
NEW_PAGE = 7
VSPACE_S = 8
VSPACE_M = 9
+2 -2
View File
@@ -834,8 +834,8 @@ class GuiDocEditor(QPlainTextEdit):
text = "% Synopsis: "
newBlock = True
goAfter = True
elif insert == nwDocInsert.SUMMARY:
text = "% Summary: "
elif insert == nwDocInsert.SHORT:
text = "% Short: "
newBlock = True
goAfter = True
elif insert == nwDocInsert.NEW_PAGE:
+9 -9
View File
@@ -316,13 +316,13 @@ class _ViewPanelBackRefs(QTreeWidget):
class _ViewPanelKeyWords(QTreeWidget):
C_DATA = 0
C_NAME = 0
C_EDIT = 1
C_VIEW = 2
C_DOC = 3
C_TITLE = 4
C_SUMMARY = 5
C_DATA = 0
C_NAME = 0
C_EDIT = 1
C_VIEW = 2
C_DOC = 3
C_TITLE = 4
C_SHORT = 5
D_TAG = Qt.ItemDataRole.UserRole
@@ -337,7 +337,7 @@ class _ViewPanelKeyWords(QTreeWidget):
self.setHeaderLabels([
self.tr("Tag"), "", "", self.tr("Document"),
self.tr("Heading"), self.tr("Summary")
self.tr("Heading"), self.tr("Short Description")
])
self.setIndentation(0)
self.setIconSize(QSize(iPx, iPx))
@@ -401,7 +401,7 @@ class _ViewPanelKeyWords(QTreeWidget):
trItem.setText(self.C_DOC, nwItem.itemName)
trItem.setText(self.C_TITLE, hItem.title)
trItem.setData(self.C_TITLE, Qt.ItemDataRole.DecorationRole, hDec)
trItem.setText(self.C_SUMMARY, hItem.synopsis)
trItem.setText(self.C_SHORT, hItem.synopsis)
trItem.setData(self.C_DATA, self.D_TAG, tag)
if tag not in self._treeMap:
+5 -5
View File
@@ -564,11 +564,11 @@ class GuiMainMenu(QMenuBar):
lambda: self.requestDocInsert.emit(nwDocInsert.SYNOPSIS)
)
# Insert > Summary Comment
self.aInsSummary = self.mInsComments.addAction(self.tr("Summary Comment"))
self.aInsSummary.setShortcut("Ctrl+K, U")
self.aInsSummary.triggered.connect(
lambda: self.requestDocInsert.emit(nwDocInsert.SUMMARY)
# Insert > Short Description Comment
self.aInsShort = self.mInsComments.addAction(self.tr("Short Description Comment"))
self.aInsShort.setShortcut("Ctrl+K, U")
self.aInsShort.triggered.connect(
lambda: self.requestDocInsert.emit(nwDocInsert.SHORT)
)
# Insert > Symbols
+1 -1
View File
@@ -1461,7 +1461,7 @@ class GuiMain(QMainWindow):
self.addAction(self.mainMenu.aInsTimes)
self.addAction(self.mainMenu.aInsDivide)
self.addAction(self.mainMenu.aInsSynopsis)
self.addAction(self.mainMenu.aInsSummary)
self.addAction(self.mainMenu.aInsShort)
for mAction, _ in self.mainMenu.mInsKWItems.values():
self.addAction(mAction)