# looking at currently
#
def BuildList(lst, fs, pagePos, cList):
- content = '\n\n<dl>\n'
+ content = '\n\n<ul>\n'
for i in range(len(lst)):
curPos = lst[i]
- nextPos = lst[i + 1] if i + 1 < len(lst) else len(fs)
+ nextPos = lst[i + 1] if i + 1 < len(lst) else len(fs)
active = ' class=active' if curPos == pagePos else ''
menuTitle = fs[curPos]['menu_title'] if 'menu_title' in fs[curPos] else fs[curPos]['title']
- content = content + '<dt' + active + '><a href="/' + fs[curPos]['filename'] + '/">' + menuTitle + '</a></dt><dd' + active + '>'
+ content = content + '<li' + active + '><a href="/' + fs[curPos]['filename'] + '/">' + menuTitle + '</a></li>'
# If the current page is our page, and it has children, enumerate them
if curPos == pagePos:
elif (pagePos > curPos) and (pagePos < nextPos):
content = content + BuildList(cList[curPos], fs, pagePos, cList)
- content = content + '</dd>\n'
-
- content = content + '</dl>\n'
+ content = content + '\n</ul>\n'
return content
# Builds the sidebar for the one-page version
#
def BuildOnePageSidebar(fs):
+
content = '\n\n<ul style="white-space:nowrap;">\n'
lvl = 0
+ levelNums = [0]*6
for i in range(len(fs)):
+ # Handle Part/Chapter/subchapter/section/subsection numbering
+ level = fs[i]['level']
+ if level == 0:
+ levelNums[2] = 0
+ levelNums[3] = 0
+ levelNums[4] = 0
+ elif level == 1:
+ levelNums[2] = 0
+ levelNums[3] = 0
+ levelNums[4] = 0
+ elif level == 2:
+ levelNums[3] = 0
+ levelNums[4] = 0
+ elif level == 3:
+ levelNums[4] = 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']:
+ while lvl < level:
content = content + '<ul style="white-space:nowrap;">\n'
lvl = lvl + 1
- while lvl > fs[i]['level']:
+ while lvl > level:
content = content + '</ul>\n'
lvl = lvl - 1
- content = content + '<li><a href="#' + anchor + '">' + fs[i]['title'] + '</a></li>\n'
+ content = content + '<li><a href="#' + anchor + '">' + txtlevel + fs[i]['title'] + '</a></li>\n'
content = content + '</ul>\n'
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] + '<dt><dt><a href="/toc/">Table of Contents</a></dt><dd></dd>\n' + content[7:]
+ active = ' class=active' if pos<0 else ''
+ content = content.replace('<ul>','<ul><li' + active + '><a href="/toc/">Table of Contents</a></li>\n',1)
return content
# Handle Part/Chapter/subchapter/section/subsection numbering
if level == 0:
levelNums[2] = 0
+ levelNums[3] = 0
+ levelNums[4] = 0
elif level == 1:
levelNums[2] = 0
+ levelNums[3] = 0
+ levelNums[4] = 0
elif level == 2:
levelNums[3] = 0
+ levelNums[4] = 0
elif level == 3:
levelNums[4] = 0
# Handle TOC scriblings and one-page titles...
opl = ''
+
if 'link' in header:
opl = ' id="' + header['link'] + '"'
else:
if level == 0:
toc = toc + '<h2>Part ' + num2roman(levelNums[level]) + ': ' + header['title'] + '</h2>\n';
- oph = '<h1' + opl +'>Part ' + num2roman(levelNums[level]) + ': ' + header['title'] + '</h1>\n';
+ oph = '<h1 class="clear"' + opl +'>Part ' + num2roman(levelNums[level]) + ' - ' + header['title'] + '</h1>\n';
elif level == 1:
- toc = toc + ' <p class="chapter">Ch. ' + str(levelNums[level]) + ': <a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
- oph = '<h1' + opl +'>Chapter ' + str(levelNums[level]) + ': ' + header['title'] + '</h1>\n';
+ toc = toc + '\t<p class="chapter">Ch. ' + str(levelNums[level]) + ': <a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
+ oph = '<h1 class="clear"' + opl +'>' + str(levelNums[level]) + ' - ' + header['title'] + '</h1>\n';
elif level == 2:
- toc = toc + ' <p class="subchapter"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
- oph = '<h1' + opl +'>Subchapter ' + str(levelNums[level]) + ': ' + header['title'] + '</h1>\n';
+ toc = toc + '\t\t<p class="subchapter"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
+ oph = '<h1 class="clear"' + opl +'>' + str(levelNums[level-1]) + '.' + str(levelNums[level]) + ' - ' + header['title'] + '</h1>\n';
elif level == 3:
- toc = toc + ' <p class="section"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
- oph = '<h1' + opl +'>Section ' + str(levelNums[level]) + ': ' + header['title'] + '</h1>\n';
+ toc = toc + '\t\t\t<p class="section"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
+ oph = '<h1 class="clear"' + opl +'>' + str(levelNums[level-2]) + '.' + str(levelNums[level-1]) + '.' + str(levelNums[level]) + ' - ' + header['title'] + '</h1>\n';
elif level == 4:
- toc = toc + ' <p class="subsection"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
- oph = '<h1' + opl +'>Subsection ' + str(levelNums[level]) + ': ' + header['title'] + '</h1>\n';
+ toc = toc + '\t\t\t\t<p class="subsection"><a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
+ oph = '<h1 class="clear"' + opl +'>' + str(levelNums[level-3]) + '.' + str(levelNums[level-2]) + '.' + str(levelNums[level-1]) + '.' + str(levelNums[level]) + ' - ' + header['title'] + '</h1>\n';
# Create the one-page version of the documentation
onepageFile = open(siteDir + 'ardourmanual.html', 'w')
+onepage = onepage.replace('{{ content }}', '') # cleans up the last spaceholder
onepageFile.write(onepage)
onepageFile.close()