Connected the Roman numbers function to the build tool
This commit is contained in:
@@ -33,7 +33,7 @@ from operator import itemgetter
|
|||||||
from PyQt5.QtCore import QRegularExpression
|
from PyQt5.QtCore import QRegularExpression
|
||||||
|
|
||||||
from nw.core.document import NWDoc
|
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
|
from nw.constants import nwItemLayout, nwItemType, nwRegEx
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -690,6 +690,10 @@ class Tokenizer():
|
|||||||
theTitle = theTitle.replace(r"%sca%", str(self.numAbsScene))
|
theTitle = theTitle.replace(r"%sca%", str(self.numAbsScene))
|
||||||
if r"%chw%" in theTitle:
|
if r"%chw%" in theTitle:
|
||||||
theTitle = theTitle.replace(r"%chw%", numberToWord(self.numChapter,"en"))
|
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
|
return theTitle
|
||||||
|
|
||||||
# END Class Tokenizer
|
# END Class Tokenizer
|
||||||
|
|||||||
+3
-1
@@ -46,7 +46,7 @@ from PyQt5.QtWidgets import (
|
|||||||
|
|
||||||
from nw.common import fuzzyTime
|
from nw.common import fuzzyTime
|
||||||
from nw.gui.custom import QSwitch
|
from nw.gui.custom import QSwitch
|
||||||
from nw.core import ToHtml
|
from nw.core import ToHtml, numberToRoman
|
||||||
from nw.constants import (
|
from nw.constants import (
|
||||||
nwAlert, nwFiles, nwItemType, nwItemLayout, nwItemClass
|
nwAlert, nwFiles, nwItemType, nwItemLayout, nwItemClass
|
||||||
)
|
)
|
||||||
@@ -105,6 +105,8 @@ class GuiBuildNovel(QDialog):
|
|||||||
r"%title% for the title as set in the document<br>"
|
r"%title% for the title as set in the document<br>"
|
||||||
r"%ch% for chapter number (1, 2, 3)<br>"
|
r"%ch% for chapter number (1, 2, 3)<br>"
|
||||||
r"%chw% for chapter number as a word (one, two)<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"%sc% for scene number within chapter<br>"
|
||||||
r"%sca% for scene number within novel"
|
r"%sca% for scene number within novel"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user