This is even better
This commit is contained in:
@@ -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 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".
|
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.
|
If the file has layout "Unnumbered", the counter is not incremented.
|
||||||
the latter is useful for for instance Prologue and Epilogue chapters.
|
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.
|
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.
|
The former keyword is reset to one for each new chapter, while the latter is not reset but counts from first scene encountered.
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
<p><mark>%ch%</mark> – This is replaced with the chapter number of your chapter type
|
<p><mark>%ch%</mark> – This is replaced with the chapter number of your chapter type
|
||||||
headings. These are generated automaticall starting from 1, but ignoring chapter headings in
|
headings. These are generated automaticall starting from 1, but ignoring chapter headings in
|
||||||
files with "Unnumbered" layout.</p>
|
files with "Unnumbered" layout.</p>
|
||||||
<p><mark>%chword%</mark> – This is replaced with the chapter number, but instead of an
|
<p><mark>%chw%</mark> – 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.</p>
|
arabic number, the word for it is used, e.g. One, Two, Fifteen, Twenty-Five, etc.</p>
|
||||||
<p><mark>%sc1%</mark> – This is replaced with the scene number. The number is reset to one
|
<p><mark>%sc%</mark> – 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.</p>
|
for each new chapter, so it is the scene number within the current chapter.</p>
|
||||||
<p><mark>%sc2%</mark> – This is replaced with the absolute scene number. That is, the
|
<p><mark>%sca%</mark> – 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.</p>
|
number is counted from the first scene in the novel, and not reset for each chapter.</p>
|
||||||
<p><mark>\\</mark> – Two backslashes are replaced by a line break.</p>
|
<p><mark>\\</mark> – Two backslashes are replaced by a line break.</p>
|
||||||
<p><b>Note:</b> The Scene and Section formats are treated slightly differently than the other title
|
<p><b>Note:</b> The Scene and Section formats are treated slightly differently than the other title
|
||||||
|
|||||||
@@ -565,11 +565,11 @@ class Tokenizer():
|
|||||||
def _formatHeading(self, theTitle, theText):
|
def _formatHeading(self, theTitle, theText):
|
||||||
"""Replaces the %keyword% strings.
|
"""Replaces the %keyword% strings.
|
||||||
"""
|
"""
|
||||||
theTitle = theTitle.replace(r"%title%", theText)
|
theTitle = theTitle.replace(r"%title%", theText)
|
||||||
theTitle = theTitle.replace(r"%ch%", str(self.numChapter))
|
theTitle = theTitle.replace(r"%ch%", str(self.numChapter))
|
||||||
theTitle = theTitle.replace(r"%sc1%", str(self.numChScene))
|
theTitle = theTitle.replace(r"%sc%", str(self.numChScene))
|
||||||
theTitle = theTitle.replace(r"%sc2%", str(self.numAbsScene))
|
theTitle = theTitle.replace(r"%sca%", str(self.numAbsScene))
|
||||||
theTitle = theTitle.replace(r"%chword%", numberToWord(self.numChapter,"en"))
|
theTitle = theTitle.replace(r"%chw%", numberToWord(self.numChapter,"en"))
|
||||||
return theTitle
|
return theTitle
|
||||||
|
|
||||||
# END Class Tokenizer
|
# END Class Tokenizer
|
||||||
|
|||||||
+3
-3
@@ -691,9 +691,9 @@ class GuiBuildNovel(QDialog):
|
|||||||
"""Translates old formatting codes to new ones.
|
"""Translates old formatting codes to new ones.
|
||||||
"""
|
"""
|
||||||
theFormat = theFormat.replace(r"%chnum%", r"%ch%")
|
theFormat = theFormat.replace(r"%chnum%", r"%ch%")
|
||||||
theFormat = theFormat.replace(r"%scnum%", r"%sc1%")
|
theFormat = theFormat.replace(r"%scnum%", r"%sc%")
|
||||||
theFormat = theFormat.replace(r"%scabsnum%", r"%sc2%")
|
theFormat = theFormat.replace(r"%scabsnum%", r"%sca%")
|
||||||
theFormat = theFormat.replace(r"%chnumword%", r"%chword%")
|
theFormat = theFormat.replace(r"%chnumword%", r"%chw%")
|
||||||
return theFormat
|
return theFormat
|
||||||
|
|
||||||
# END Class GuiBuildNovel
|
# END Class GuiBuildNovel
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="0.6.1" hexVersion="0x000601f0" fileVersion="1.0" saveCount="170" autoCount="26" timeStamp="2020-05-28 00:22:19">
|
<novelWriterXML appVersion="0.6.1" hexVersion="0x000601f0" fileVersion="1.0" saveCount="172" autoCount="27" timeStamp="2020-05-28 00:29:31">
|
||||||
<project>
|
<project>
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<title>%title%</title>
|
<title>%title%</title>
|
||||||
<chapter>Chapter %ch%: %title%</chapter>
|
<chapter>Chapter %ch%: %title%</chapter>
|
||||||
<unnumbered>%title%</unnumbered>
|
<unnumbered>%title%</unnumbered>
|
||||||
<scene>* * *</scene>
|
<scene>Scene %ch%.%sc%: %title%</scene>
|
||||||
<section></section>
|
<section></section>
|
||||||
<withSynopsis>True</withSynopsis>
|
<withSynopsis>True</withSynopsis>
|
||||||
<withComments>True</withComments>
|
<withComments>True</withComments>
|
||||||
|
|||||||
Reference in New Issue
Block a user