Move the setNestedToC setting to the Epub class

This commit is contained in:
Veronica Berglyd Olsen
2026-11-02 21:31:48 +01:00
parent 9843084b03
commit fd4333c0e4
2 changed files with 7 additions and 7 deletions

View File

@@ -87,7 +87,7 @@ class ToEPub(ToHtml):
Extend the ToHtml class to write EPub output.
"""
__slots__ = ("_isFront", "_nextFnIndex", "_section", "_sections")
__slots__ = ("_isFront", "_nestedToc", "_nextFnIndex", "_section", "_sections")
def __init__(self, project: NWProject) -> None:
super().__init__(project)
@@ -97,6 +97,7 @@ class ToEPub(ToHtml):
self._brTag = "<br />"
self._nextFnIndex = 1
self._useAnchors = False
self._nestedToc = False
##
# Setters
@@ -106,6 +107,10 @@ class ToEPub(ToHtml):
"""Set translation map. Replace Unicode is ignored for EPub."""
self._trMap = str.maketrans({"&": "&amp;"})
def setNestedToC(self, value: bool) -> None:
"""Set a nested table of contents."""
self._nestedToc = value
##
# Class Methods
##

View File

@@ -81,13 +81,12 @@ class ToHtml(Tokenizer):
Extend the Tokenizer class to write HTML output.
"""
__slots__ = ("_brTag", "_cssStyles", "_nestedToc", "_trMap", "_usedFields", "_usedNotes")
__slots__ = ("_brTag", "_cssStyles", "_trMap", "_usedFields", "_usedNotes")
def __init__(self, project: NWProject) -> None:
super().__init__(project)
self._trMap = {}
self._cssStyles = True
self._nestedToc = False
self._usedNotes: dict[str, int] = {}
self._usedFields: list[tuple[int, str]] = []
self._brTag = "<br>"
@@ -115,10 +114,6 @@ class ToHtml(Tokenizer):
# Extend to all relevant Unicode characters
self._trMap.update(str.maketrans(nwHtmlUnicode.U_TO_H))
def setNestedToC(self, value: bool) -> None:
"""Set a nested table of contents."""
self._nestedToc = value
##
# Class Methods
##