Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
077fffa8
Kaydet (Commit)
077fffa8
authored
Agu 07, 1998
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
The letter headings must be requested explicitly with --letters.
üst
aa3f9fb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
buildindex.py
Doc/tools/buildindex.py
+15
-5
No files found.
Doc/tools/buildindex.py
Dosyayı görüntüle @
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