Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8490c7

Browse files
committed
Move "everything left one": the TOC now shows each doc directory as a
distinct top-level node. Before they were all nested under an artificial top-level node, uselessly chewing up horizontal space, and ensuring that the only thing the user saw in the TOC upon opening the file was a single collapsed top-level folder.
1 parent 4545407 commit c8490c7

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Doc/tools/prechm.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,10 @@
6868
<param name="ImageType" value="Folder">
6969
</OBJECT>
7070
<UL>
71-
<LI><OBJECT type="text/sitemap">
72-
<param name="Name" value="Python %s Docs">
73-
<param name="Local" value="./index.html">
74-
</OBJECT>
75-
<UL>
7671
'''
7772

7873
contents_footer = '''\
79-
</UL></UL></BODY></HTML>
74+
</UL></BODY></HTML>
8075
'''
8176

8277
object_sitemap = '''\
@@ -124,8 +119,9 @@ def __init__(self, directory, title, firstpage,
124119
# Library Doc list of books:
125120
# each 'book' : (Dir, Title, First page, Content page, Index page)
126121
supported_libraries = {
127-
'2.2': ### Beta!!! fix for actual release
122+
'2.2':
128123
[
124+
Book('.', 'Main page', 'index'),
129125
Book('.', 'Global Module Index', 'modindex'),
130126
Book('whatsnew', "What's New", 'index', 'contents'),
131127
Book('tut','Tutorial','tut','node2'),
@@ -141,6 +137,7 @@ def __init__(self, directory, title, firstpage,
141137

142138
'2.1.1':
143139
[
140+
Book('.', 'Main page', 'index'),
144141
Book('.', 'Global Module Index', 'modindex'),
145142
Book('tut','Tutorial','tut','node2'),
146143
Book('lib','Library Reference','lib','contents','genindex'),
@@ -341,7 +338,7 @@ def do_index(library, output):
341338
output.write('</UL>\n')
342339

343340
def do_content(library, version, output):
344-
output.write(contents_header % version)
341+
output.write(contents_header)
345342
for book in library:
346343
print '\t', book.title, '-', book.firstpage
347344
path = book.directory + "/" + book.firstpage
@@ -356,12 +353,16 @@ def do_content(library, version, output):
356353
# supported_libraries for the version of the docs getting generated.
357354
def do_project(library, output, arch, version):
358355
output.write(project_template % locals())
356+
pathseen = {}
359357
for book in library:
360358
directory = book.directory
361359
path = directory + '\\%s\n'
362360
for page in os.listdir(directory):
363361
if page.endswith('.html') or page.endswith('.css'):
364-
output.write(path % page)
362+
fullpath = path % page
363+
if fullpath not in pathseen:
364+
output.write(fullpath)
365+
pathseen[fullpath] = True
365366

366367
def openfile(file):
367368
try:

0 commit comments

Comments
 (0)