From f9e2d57fa7330dacf57f3c3e5b9d9e17a4395e0e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 28 May 2020 00:29:45 +0200 Subject: [PATCH] This is even better --- docs/source/export.txt | 4 ++-- nw/assets/text/exportHelp_en.htm | 6 +++--- nw/core/tokenizer.py | 10 +++++----- nw/gui/build.py | 6 +++--- sample/nwProject.nwx | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/source/export.txt b/docs/source/export.txt index 2c462c90..62e81e2f 100644 --- a/docs/source/export.txt +++ b/docs/source/export.txt @@ -13,12 +13,12 @@ This is done through a series of keyword-replace steps. The keyword ``%title%`` will always be replaced by the text you put after the ``#`` characters in your document. -The keywords ``%ch%`` and ``%chword%`` is replaced by a number, or a number word, respectively. +The keywords ``%ch%`` and ``%chw%`` is replaced by a number, or a number word, respectively. The number is incremented by one each time the build tool sees a new heading of level two in a file with layout "Chapter". If the file has layout "Unnumbered", the counter is not incremented. the latter is useful for for instance Prologue and Epilogue chapters. -Likewise, the keywords ``%sc1%`` and ``%sc2%`` are number counters for scene files. +Likewise, the keywords ``%sc%`` and ``%sca%`` are number counters for scene files. These are incremented each time a heading of level three is encountered. The former keyword is reset to one for each new chapter, while the latter is not reset but counts from first scene encountered. diff --git a/nw/assets/text/exportHelp_en.htm b/nw/assets/text/exportHelp_en.htm index 3c6824a1..8287f7e9 100644 --- a/nw/assets/text/exportHelp_en.htm +++ b/nw/assets/text/exportHelp_en.htm @@ -12,11 +12,11 @@
%ch% – This is replaced with the chapter number of your chapter type headings. These are generated automaticall starting from 1, but ignoring chapter headings in files with "Unnumbered" layout.
-%chword% – This is replaced with the chapter number, but instead of an +
%chw% – This is replaced with the chapter number, but instead of an arabic number, the word for it is used, e.g. One, Two, Fifteen, Twenty-Five, etc.
-%sc1% – This is replaced with the scene number. The number is reset to one +
%sc% – This is replaced with the scene number. The number is reset to one for each new chapter, so it is the scene number within the current chapter.
-%sc2% – This is replaced with the absolute scene number. That is, the +
%sca% – This is replaced with the absolute scene number. That is, the number is counted from the first scene in the novel, and not reset for each chapter.
\\ – Two backslashes are replaced by a line break.
Note: The Scene and Section formats are treated slightly differently than the other title
diff --git a/nw/core/tokenizer.py b/nw/core/tokenizer.py
index 9d820585..8de64118 100644
--- a/nw/core/tokenizer.py
+++ b/nw/core/tokenizer.py
@@ -565,11 +565,11 @@ class Tokenizer():
def _formatHeading(self, theTitle, theText):
"""Replaces the %keyword% strings.
"""
- theTitle = theTitle.replace(r"%title%", theText)
- theTitle = theTitle.replace(r"%ch%", str(self.numChapter))
- theTitle = theTitle.replace(r"%sc1%", str(self.numChScene))
- theTitle = theTitle.replace(r"%sc2%", str(self.numAbsScene))
- theTitle = theTitle.replace(r"%chword%", numberToWord(self.numChapter,"en"))
+ theTitle = theTitle.replace(r"%title%", theText)
+ theTitle = theTitle.replace(r"%ch%", str(self.numChapter))
+ theTitle = theTitle.replace(r"%sc%", str(self.numChScene))
+ theTitle = theTitle.replace(r"%sca%", str(self.numAbsScene))
+ theTitle = theTitle.replace(r"%chw%", numberToWord(self.numChapter,"en"))
return theTitle
# END Class Tokenizer
diff --git a/nw/gui/build.py b/nw/gui/build.py
index af8f7d9e..5d37add6 100644
--- a/nw/gui/build.py
+++ b/nw/gui/build.py
@@ -691,9 +691,9 @@ class GuiBuildNovel(QDialog):
"""Translates old formatting codes to new ones.
"""
theFormat = theFormat.replace(r"%chnum%", r"%ch%")
- theFormat = theFormat.replace(r"%scnum%", r"%sc1%")
- theFormat = theFormat.replace(r"%scabsnum%", r"%sc2%")
- theFormat = theFormat.replace(r"%chnumword%", r"%chword%")
+ theFormat = theFormat.replace(r"%scnum%", r"%sc%")
+ theFormat = theFormat.replace(r"%scabsnum%", r"%sca%")
+ theFormat = theFormat.replace(r"%chnumword%", r"%chw%")
return theFormat
# END Class GuiBuildNovel
diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx
index 5e29e0bd..04c40574 100644
--- a/sample/nwProject.nwx
+++ b/sample/nwProject.nwx
@@ -1,5 +1,5 @@
-