\n'
# If the current page is our page, and it has children, enumerate them
if curPos == pagePos:
@@ -332,9 +346,7 @@ def BuildList(lst, fs, pagePos, cList):
elif (pagePos > curPos) and (pagePos < nextPos):
content = content + BuildList(cList[curPos], fs, pagePos, cList)
- content = content + '
\n'
-
- content = content + '
\n'
+ content = content + '\n'
return content
@@ -343,23 +355,43 @@ def BuildList(lst, fs, pagePos, cList):
# Builds the sidebar for the one-page version
#
def BuildOnePageSidebar(fs):
- content = '\n\n
\n'
+
+ content = '\n\n
\n'
lvl = 0
+ levelNums = [0] * 5
for i in range(len(fs)):
+ # Handle Part/Chapter/subchapter/section/subsection numbering
+ level = fs[i]['level']
+
+ if level < 2:
+ levelNums[2] = 0
+
+ levelNums[level] = levelNums[level] + 1;
+ j = level
+ txtlevel = ''
+
+ while j > 0: #level 0 is the part number which is not shown
+ txtlevel = str(levelNums[j]) + '.' + txtlevel
+ j = j - 1
+
+ if len(txtlevel) > 0:
+ txtlevel = txtlevel[:-1] + ' - '
+
if 'link' in fs[i]:
anchor = fs[i]['link']
else:
anchor = fs[i]['filename']
- while lvl < fs[i]['level']:
- content = content + '
\n'
@@ -372,13 +404,14 @@ def BuildOnePageSidebar(fs):
def CreateLinkSidebar(fs, pos, childList):
# Build the list recursively from the top level nodes
- #content = BuildList(FindTopLevelNodes(fs), fs, pos, childList)
content = BuildList(FindTopLevelNodes(fs), fs, pos, childList)
# Shove the TOC link and one file link at the top...
- content = content[:7] + '