Connected the Roman numbers function to the build tool

This commit is contained in:
Veronica K. B. Olsen
2020-07-05 16:56:06 +02:00
parent 1cb17733c6
commit 7816bf5b87
2 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -33,7 +33,7 @@ from operator import itemgetter
from PyQt5.QtCore import QRegularExpression
from nw.core.document import NWDoc
from nw.core.tools import numberToWord
from nw.core.tools import numberToWord, numberToRoman
from nw.constants import nwItemLayout, nwItemType, nwRegEx
logger = logging.getLogger(__name__)
@@ -690,6 +690,10 @@ class Tokenizer():
theTitle = theTitle.replace(r"%sca%", str(self.numAbsScene))
if r"%chw%" in theTitle:
theTitle = theTitle.replace(r"%chw%", numberToWord(self.numChapter,"en"))
if r"%chi%" in theTitle:
theTitle = theTitle.replace(r"%chi%", numberToRoman(self.numChapter, True))
if r"%chI%" in theTitle:
theTitle = theTitle.replace(r"%chI%", numberToRoman(self.numChapter, False))
return theTitle
# END Class Tokenizer
+3 -1
View File
@@ -46,7 +46,7 @@ from PyQt5.QtWidgets import (
from nw.common import fuzzyTime
from nw.gui.custom import QSwitch
from nw.core import ToHtml
from nw.core import ToHtml, numberToRoman
from nw.constants import (
nwAlert, nwFiles, nwItemType, nwItemLayout, nwItemClass
)
@@ -105,6 +105,8 @@ class GuiBuildNovel(QDialog):
r"%title% for the title as set in the document<br>"
r"%ch% for chapter number (1, 2, 3)<br>"
r"%chw% for chapter number as a word (one, two)<br>"
r"%chI% for chapter number in upper case Roman<br>"
r"%chi% for chapter number in lower case Roman<br>"
r"%sc% for scene number within chapter<br>"
r"%sca% for scene number within novel"
)