Update the index to generate a ToC for a specific root folder

This commit is contained in:
Veronica Berglyd Olsen
2022-10-01 22:02:00 +02:00
parent f4eed2bf2c
commit 479478490e
2 changed files with 10 additions and 8 deletions
+4 -2
View File
@@ -498,13 +498,15 @@ class NWIndex:
"""
return self._itemIndex.mainItemHeader(tHandle)
def getTableOfContents(self, maxDepth, skipExcl=True):
def getTableOfContents(self, rootHandle, maxDepth, skipExcl=True):
"""Generate a table of contents up to a maximum depth.
"""
tOrder = []
tData = {}
pKey = None
for tHandle, sTitle, hItem in self._itemIndex.iterNovelStructure(skipExcl=skipExcl):
for tHandle, sTitle, hItem in self._itemIndex.iterNovelStructure(
rootHandle=rootHandle, skipExcl=skipExcl
):
tKey = f"{tHandle}:{sTitle}"
iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0)
if iLevel > maxDepth: