Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
077fffa8
Commit
077fffa8
authored
Aug 07, 1998
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The letter headings must be requested explicitly with --letters.
parent
aa3f9fb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
Doc/tools/buildindex.py
Doc/tools/buildindex.py
+15
-5
No files found.
Doc/tools/buildindex.py
View file @
077fffa8
...
...
@@ -151,7 +151,7 @@ def split_letters(nodes):
# need a function to separate the nodes into columns...
def
split_columns
(
nodes
,
columns
=
1
):
if
columns
<=
1
:
return
(
nodes
,)
return
[
nodes
]
# This is a rough height; we may have to increase to avoid breaks before
# a subitem.
colheight
=
len
(
nodes
)
/
columns
...
...
@@ -176,7 +176,7 @@ def split_columns(nodes, columns=1):
start
=
i
*
colheight
end
=
start
+
colheight
cols
.
append
(
nodes
[
start
:
end
])
return
tuple
(
cols
)
return
cols
DL_LEVEL_INDENT
=
" "
...
...
@@ -249,7 +249,7 @@ def format_letter(letter):
%
(
letter
,
lettername
)
def
format_html
(
nodes
,
columns
=
1
):
def
format_html
_letters
(
nodes
,
columns
=
1
):
letter_groups
=
split_letters
(
nodes
)
items
=
[]
for
letter
,
nodes
in
letter_groups
:
...
...
@@ -261,6 +261,9 @@ def format_html(nodes, columns=1):
s
.
append
(
format_nodes
(
nodes
,
columns
))
return
string
.
join
(
s
,
''
)
def
format_html
(
nodes
,
columns
):
return
format_nodes
(
nodes
,
columns
)
def
collapse
(
nodes
):
"""Collapse sequences of nodes with matching keys into a single node.
...
...
@@ -289,12 +292,16 @@ def main():
ifn
=
"-"
ofn
=
"-"
columns
=
1
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"c:o:"
,
[
"columns="
,
"output="
])
letters
=
0
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"c:lo:"
,
[
"columns="
,
"letters"
,
"output="
])
for
opt
,
val
in
opts
:
if
opt
in
(
"-o"
,
"--output"
):
ofn
=
val
elif
opt
in
(
"-c"
,
"--columns"
):
columns
=
string
.
atoi
(
val
)
elif
opt
in
(
"-l"
,
"--letters"
):
letters
=
1
if
not
args
:
args
=
[
ifn
]
nodes
=
[]
...
...
@@ -302,7 +309,10 @@ def main():
nodes
=
nodes
+
load
(
open
(
fn
))
nodes
.
sort
()
collapse
(
nodes
)
html
=
format_html
(
nodes
,
columns
)
if
letters
:
html
=
format_html_letters
(
nodes
,
columns
)
else
:
html
=
format_html
(
nodes
,
columns
)
if
ofn
==
"-"
:
sys
.
stdout
.
write
(
html
)
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment