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
c76b1c95
Kaydet (Commit)
c76b1c95
authored
Eyl 27, 2015
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge heads
üst
1dd72e6b
28670d1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
help.py
Lib/idlelib/help.py
+14
-22
No files found.
Lib/idlelib/help.py
Dosyayı görüntüle @
c76b1c95
...
@@ -55,12 +55,11 @@ class HelpParser(HTMLParser):
...
@@ -55,12 +55,11 @@ class HelpParser(HTMLParser):
self
.
hdrlink
=
False
# used so we don't show header links
self
.
hdrlink
=
False
# used so we don't show header links
self
.
level
=
0
# indentation level
self
.
level
=
0
# indentation level
self
.
pre
=
False
# displaying preformatted text
self
.
pre
=
False
# displaying preformatted text
self
.
hprefix
=
''
#
strip e.g. '25.5'
from headings
self
.
hprefix
=
''
#
prefix such as '25.5' to strip
from headings
self
.
nested_dl
=
False
# if we're in a nested <dl>
self
.
nested_dl
=
False
# if we're in a nested <dl>
self
.
simplelist
=
False
# simple list (no double spacing)
self
.
simplelist
=
False
# simple list (no double spacing)
self
.
tocid
=
1
# id for table of contents entries
self
.
toc
=
[]
# pair headers with text indexes for toc
self
.
contents
=
[]
# map toc ids to section titles
self
.
header
=
''
# text within header tags for toc
self
.
data
=
''
# to record data within header tags for toc
def
indent
(
self
,
amt
=
1
):
def
indent
(
self
,
amt
=
1
):
self
.
level
+=
amt
self
.
level
+=
amt
...
@@ -111,14 +110,10 @@ class HelpParser(HTMLParser):
...
@@ -111,14 +110,10 @@ class HelpParser(HTMLParser):
elif
tag
==
'a'
and
class_
==
'headerlink'
:
elif
tag
==
'a'
and
class_
==
'headerlink'
:
self
.
hdrlink
=
True
self
.
hdrlink
=
True
elif
tag
==
'h1'
:
elif
tag
==
'h1'
:
self
.
text
.
mark_set
(
'toc'
+
str
(
self
.
tocid
),
self
.
text
.
index
(
'end-1line'
))
self
.
tags
=
tag
self
.
tags
=
tag
elif
tag
in
[
'h2'
,
'h3'
]:
elif
tag
in
[
'h2'
,
'h3'
]:
if
self
.
show
:
if
self
.
show
:
self
.
data
=
''
self
.
header
=
''
self
.
text
.
mark_set
(
'toc'
+
str
(
self
.
tocid
),
self
.
text
.
index
(
'end-1line'
))
self
.
text
.
insert
(
'end'
,
'
\n\n
'
)
self
.
text
.
insert
(
'end'
,
'
\n\n
'
)
self
.
tags
=
tag
self
.
tags
=
tag
if
self
.
show
:
if
self
.
show
:
...
@@ -128,10 +123,8 @@ class HelpParser(HTMLParser):
...
@@ -128,10 +123,8 @@ class HelpParser(HTMLParser):
"Handle endtags in help.html."
"Handle endtags in help.html."
if
tag
in
[
'h1'
,
'h2'
,
'h3'
]:
if
tag
in
[
'h1'
,
'h2'
,
'h3'
]:
self
.
indent
(
0
)
# clear tag, reset indent
self
.
indent
(
0
)
# clear tag, reset indent
if
self
.
show
and
tag
in
[
'h1'
,
'h2'
,
'h3'
]:
if
self
.
show
:
title
=
self
.
data
self
.
toc
.
append
((
self
.
header
,
self
.
text
.
index
(
'insert'
)))
self
.
contents
.
append
((
'toc'
+
str
(
self
.
tocid
),
title
))
self
.
tocid
+=
1
elif
tag
in
[
'span'
,
'em'
]:
elif
tag
in
[
'span'
,
'em'
]:
self
.
chartags
=
''
self
.
chartags
=
''
elif
tag
==
'a'
:
elif
tag
==
'a'
:
...
@@ -151,7 +144,7 @@ class HelpParser(HTMLParser):
...
@@ -151,7 +144,7 @@ class HelpParser(HTMLParser):
if
self
.
tags
in
[
'h1'
,
'h2'
,
'h3'
]
and
self
.
hprefix
!=
''
:
if
self
.
tags
in
[
'h1'
,
'h2'
,
'h3'
]
and
self
.
hprefix
!=
''
:
if
d
[
0
:
len
(
self
.
hprefix
)]
==
self
.
hprefix
:
if
d
[
0
:
len
(
self
.
hprefix
)]
==
self
.
hprefix
:
d
=
d
[
len
(
self
.
hprefix
):]
.
strip
()
d
=
d
[
len
(
self
.
hprefix
):]
.
strip
()
self
.
data
+=
d
self
.
header
+=
d
self
.
text
.
insert
(
'end'
,
d
,
(
self
.
tags
,
self
.
chartags
))
self
.
text
.
insert
(
'end'
,
d
,
(
self
.
tags
,
self
.
chartags
))
...
@@ -205,19 +198,18 @@ class HelpFrame(Frame):
...
@@ -205,19 +198,18 @@ class HelpFrame(Frame):
self
[
'background'
]
=
text
[
'background'
]
self
[
'background'
]
=
text
[
'background'
]
scroll
=
Scrollbar
(
self
,
command
=
text
.
yview
)
scroll
=
Scrollbar
(
self
,
command
=
text
.
yview
)
text
[
'yscrollcommand'
]
=
scroll
.
set
text
[
'yscrollcommand'
]
=
scroll
.
set
self
.
rowconfigure
(
0
,
weight
=
1
)
self
.
columnconfigure
(
1
,
weight
=
1
)
# text
self
.
toc_menu
(
text
)
.
grid
(
column
=
0
,
row
=
0
,
sticky
=
'nw'
)
text
.
grid
(
column
=
1
,
row
=
0
,
sticky
=
'nsew'
)
text
.
grid
(
column
=
1
,
row
=
0
,
sticky
=
'nsew'
)
scroll
.
grid
(
column
=
2
,
row
=
0
,
sticky
=
'ns'
)
scroll
.
grid
(
column
=
2
,
row
=
0
,
sticky
=
'ns'
)
self
.
grid_columnconfigure
(
1
,
weight
=
1
)
self
.
grid_rowconfigure
(
0
,
weight
=
1
)
toc
=
self
.
contents_widget
(
text
)
toc
.
grid
(
column
=
0
,
row
=
0
,
sticky
=
'nw'
)
def
contents_widget
(
self
,
text
):
def
toc_menu
(
self
,
text
):
"Create table of contents."
"Create table of contents
as drop-down menu
."
toc
=
Menubutton
(
self
,
text
=
'TOC'
)
toc
=
Menubutton
(
self
,
text
=
'TOC'
)
drop
=
Menu
(
toc
,
tearoff
=
False
)
drop
=
Menu
(
toc
,
tearoff
=
False
)
for
tag
,
lbl
in
text
.
parser
.
contents
:
for
lbl
,
dex
in
text
.
parser
.
toc
:
drop
.
add_command
(
label
=
lbl
,
command
=
lambda
mark
=
tag
:
text
.
see
(
mark
))
drop
.
add_command
(
label
=
lbl
,
command
=
lambda
dex
=
dex
:
text
.
yview
(
dex
))
toc
[
'menu'
]
=
drop
toc
[
'menu'
]
=
drop
return
toc
return
toc
...
...
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