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
1dba24ee
Kaydet (Commit)
1dba24ee
authored
Mar 04, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
remove redundant backslashes; some cosnetics
üst
7b5430f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
69 deletions
+69
-69
htmllib.py
Lib/htmllib.py
+59
-60
sgmllib.py
Lib/sgmllib.py
+10
-9
No files found.
Lib/htmllib.py
Dosyayı görüntüle @
1dba24ee
...
@@ -62,7 +62,7 @@ class CollectingParser(HTMLParser):
...
@@ -62,7 +62,7 @@ class CollectingParser(HTMLParser):
def
__init__
(
self
):
def
__init__
(
self
):
HTMLParser
.
__init__
(
self
)
HTMLParser
.
__init__
(
self
)
self
.
savetext
=
None
self
.
savetext
=
None
self
.
nextid
=
''
self
.
nextid
=
[]
self
.
isindex
=
0
self
.
isindex
=
0
self
.
title
=
''
self
.
title
=
''
self
.
inanchor
=
0
self
.
inanchor
=
0
...
@@ -470,54 +470,54 @@ class NullStylesheet:
...
@@ -470,54 +470,54 @@ class NullStylesheet:
class
X11Stylesheet
(
NullStylesheet
):
class
X11Stylesheet
(
NullStylesheet
):
stdfontset
=
[
\
stdfontset
=
[
'-*-helvetica-medium-r-normal-*-*-100-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-r-normal-*-*-100-100-*-*-*-*-*'
,
'-*-helvetica-medium-o-normal-*-*-100-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-o-normal-*-*-100-100-*-*-*-*-*'
,
'-*-helvetica-bold-r-normal-*-*-100-100-*-*-*-*-*'
,
\
'-*-helvetica-bold-r-normal-*-*-100-100-*-*-*-*-*'
,
'-*-courier-medium-r-normal-*-*-100-100-*-*-*-*-*'
,
\
'-*-courier-medium-r-normal-*-*-100-100-*-*-*-*-*'
,
]
]
h1fontset
=
[
\
h1fontset
=
[
'-*-helvetica-medium-r-normal-*-*-180-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-r-normal-*-*-180-100-*-*-*-*-*'
,
'-*-helvetica-medium-o-normal-*-*-180-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-o-normal-*-*-180-100-*-*-*-*-*'
,
'-*-helvetica-bold-r-normal-*-*-180-100-*-*-*-*-*'
,
\
'-*-helvetica-bold-r-normal-*-*-180-100-*-*-*-*-*'
,
]
]
h2fontset
=
[
\
h2fontset
=
[
'-*-helvetica-medium-r-normal-*-*-140-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-r-normal-*-*-140-100-*-*-*-*-*'
,
'-*-helvetica-medium-o-normal-*-*-140-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-o-normal-*-*-140-100-*-*-*-*-*'
,
'-*-helvetica-bold-r-normal-*-*-140-100-*-*-*-*-*'
,
\
'-*-helvetica-bold-r-normal-*-*-140-100-*-*-*-*-*'
,
]
]
h3fontset
=
[
\
h3fontset
=
[
'-*-helvetica-medium-r-normal-*-*-120-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-r-normal-*-*-120-100-*-*-*-*-*'
,
'-*-helvetica-medium-o-normal-*-*-120-100-*-*-*-*-*'
,
\
'-*-helvetica-medium-o-normal-*-*-120-100-*-*-*-*-*'
,
'-*-helvetica-bold-r-normal-*-*-120-100-*-*-*-*-*'
,
\
'-*-helvetica-bold-r-normal-*-*-120-100-*-*-*-*-*'
,
]
]
ddindent
=
40
ddindent
=
40
class
MacStylesheet
(
NullStylesheet
):
class
MacStylesheet
(
NullStylesheet
):
stdfontset
=
[
\
stdfontset
=
[
(
'Geneva'
,
'p'
,
10
),
\
(
'Geneva'
,
'p'
,
10
),
(
'Geneva'
,
'i'
,
10
),
\
(
'Geneva'
,
'i'
,
10
),
(
'Geneva'
,
'b'
,
10
),
\
(
'Geneva'
,
'b'
,
10
),
(
'Monaco'
,
'p'
,
10
),
\
(
'Monaco'
,
'p'
,
10
),
]
]
h1fontset
=
[
\
h1fontset
=
[
(
'Geneva'
,
'p'
,
18
),
\
(
'Geneva'
,
'p'
,
18
),
(
'Geneva'
,
'i'
,
18
),
\
(
'Geneva'
,
'i'
,
18
),
(
'Geneva'
,
'b'
,
18
),
\
(
'Geneva'
,
'b'
,
18
),
(
'Monaco'
,
'p'
,
18
),
\
(
'Monaco'
,
'p'
,
18
),
]
]
h3fontset
=
[
\
h3fontset
=
[
(
'Geneva'
,
'p'
,
14
),
\
(
'Geneva'
,
'p'
,
14
),
(
'Geneva'
,
'i'
,
14
),
\
(
'Geneva'
,
'i'
,
14
),
(
'Geneva'
,
'b'
,
14
),
\
(
'Geneva'
,
'b'
,
14
),
(
'Monaco'
,
'p'
,
14
),
\
(
'Monaco'
,
'p'
,
14
),
]
]
h3fontset
=
[
\
h3fontset
=
[
(
'Geneva'
,
'p'
,
12
),
\
(
'Geneva'
,
'p'
,
12
),
(
'Geneva'
,
'i'
,
12
),
\
(
'Geneva'
,
'i'
,
12
),
(
'Geneva'
,
'b'
,
12
),
\
(
'Geneva'
,
'b'
,
12
),
(
'Monaco'
,
'p'
,
12
),
\
(
'Monaco'
,
'p'
,
12
),
]
]
...
@@ -528,29 +528,29 @@ else:
...
@@ -528,29 +528,29 @@ else:
class
GLStylesheet
(
NullStylesheet
):
class
GLStylesheet
(
NullStylesheet
):
stdfontset
=
[
\
stdfontset
=
[
'Helvetica 10'
,
\
'Helvetica 10'
,
'Helvetica-Italic 10'
,
\
'Helvetica-Italic 10'
,
'Helvetica-Bold 10'
,
\
'Helvetica-Bold 10'
,
'Courier 10'
,
\
'Courier 10'
,
]
]
h1fontset
=
[
\
h1fontset
=
[
'Helvetica 18'
,
\
'Helvetica 18'
,
'Helvetica-Italic 18'
,
\
'Helvetica-Italic 18'
,
'Helvetica-Bold 18'
,
\
'Helvetica-Bold 18'
,
'Courier 18'
,
\
'Courier 18'
,
]
]
h2fontset
=
[
\
h2fontset
=
[
'Helvetica 14'
,
\
'Helvetica 14'
,
'Helvetica-Italic 14'
,
\
'Helvetica-Italic 14'
,
'Helvetica-Bold 14'
,
\
'Helvetica-Bold 14'
,
'Courier 14'
,
\
'Courier 14'
,
]
]
h3fontset
=
[
\
h3fontset
=
[
'Helvetica 12'
,
\
'Helvetica 12'
,
'Helvetica-Italic 12'
,
\
'Helvetica-Italic 12'
,
'Helvetica-Bold 12'
,
\
'Helvetica-Bold 12'
,
'Courier 12'
,
\
'Courier 12'
,
]
]
...
@@ -595,8 +595,7 @@ def testStdwin():
...
@@ -595,8 +595,7 @@ def testStdwin():
if
not
b
:
if
not
b
:
b
=
fmt
.
StdwinBackEnd
(
window
,
1
)
b
=
fmt
.
StdwinBackEnd
(
window
,
1
)
f
=
fmt
.
BaseFormatter
(
b
.
d
,
b
)
f
=
fmt
.
BaseFormatter
(
b
.
d
,
b
)
p
=
FormattingParser
(
f
,
\
p
=
FormattingParser
(
f
,
MacStylesheet
)
MacStylesheet
)
p
.
feed
(
data
)
p
.
feed
(
data
)
p
.
close
()
p
.
close
()
b
.
finish
()
b
.
finish
()
...
...
Lib/sgmllib.py
Dosyayı görüntüle @
1dba24ee
...
@@ -14,8 +14,8 @@ import string
...
@@ -14,8 +14,8 @@ import string
# Regular expressions used for parsing
# Regular expressions used for parsing
incomplete
=
regex
.
compile
(
\
incomplete
=
regex
.
compile
(
'<!-?
\
|</[a-zA-Z][a-zA-Z0-9]*[
\t\n
]*
\
|</?
\
|'
+
\
'<!-?
\
|</[a-zA-Z][a-zA-Z0-9]*[
\t\n
]*
\
|</?
\
|'
+
'&#[a-zA-Z0-9]*
\
|&[a-zA-Z][a-zA-Z0-9]*
\
|&'
)
'&#[a-zA-Z0-9]*
\
|&[a-zA-Z][a-zA-Z0-9]*
\
|&'
)
entityref
=
regex
.
compile
(
'&[a-zA-Z][a-zA-Z0-9]*[;.]'
)
entityref
=
regex
.
compile
(
'&[a-zA-Z][a-zA-Z0-9]*[;.]'
)
charref
=
regex
.
compile
(
'&#[a-zA-Z0-9]+;'
)
charref
=
regex
.
compile
(
'&#[a-zA-Z0-9]+;'
)
...
@@ -59,7 +59,7 @@ class SGMLParser:
...
@@ -59,7 +59,7 @@ class SGMLParser:
# Interface -- feed some data to the parser. Call this as
# Interface -- feed some data to the parser. Call this as
# often as you want, with as little or as much text as you
# often as you want, with as little or as much text as you
# want (may include '\n'). (This just saves the text, all the
# want (may include '\n'). (This just saves the text, all the
# processing is done by
process() or close
().)
# processing is done by
goahead
().)
def
feed
(
self
,
data
):
def
feed
(
self
,
data
):
self
.
rawdata
=
self
.
rawdata
+
data
self
.
rawdata
=
self
.
rawdata
+
data
self
.
goahead
(
0
)
self
.
goahead
(
0
)
...
@@ -172,9 +172,9 @@ class SGMLParser:
...
@@ -172,9 +172,9 @@ class SGMLParser:
# Now parse the data between i+1 and j into a tag and attrs
# Now parse the data between i+1 and j into a tag and attrs
attrs
=
[]
attrs
=
[]
tagfind
=
regex
.
compile
(
'[a-zA-Z][a-zA-Z0-9]*'
)
tagfind
=
regex
.
compile
(
'[a-zA-Z][a-zA-Z0-9]*'
)
attrfind
=
regex
.
compile
(
\
attrfind
=
regex
.
compile
(
'[
\t\n
]+
\
([a-zA-Z][a-zA-Z0-9]*
\
)'
+
\
'[
\t\n
]+
\
([a-zA-Z][a-zA-Z0-9]*
\
)'
+
'
\
([
\t\n
]*=[
\t\n
]*'
+
\
'
\
([
\t\n
]*=[
\t\n
]*'
+
'
\
(
\'
[^
\'
]*
\'
;
\
|"[^"]*"
\
|[-a-zA-Z0-9./:+*
%
?!()_#]+
\
)
\
)?'
)
'
\
(
\'
[^
\'
]*
\'
;
\
|"[^"]*"
\
|[-a-zA-Z0-9./:+*
%
?!()_#]+
\
)
\
)?'
)
k
=
tagfind
.
match
(
rawdata
,
i
+
1
)
k
=
tagfind
.
match
(
rawdata
,
i
+
1
)
if
k
<
0
:
if
k
<
0
:
...
@@ -196,7 +196,7 @@ class SGMLParser:
...
@@ -196,7 +196,7 @@ class SGMLParser:
attrvalue
=
attrvalue
[
1
:
-
1
]
attrvalue
=
attrvalue
[
1
:
-
1
]
else
:
else
:
attrvalue
=
''
attrvalue
=
''
attrs
.
append
(
string
.
lower
(
attrname
),
attrvalue
)
attrs
.
append
(
(
string
.
lower
(
attrname
),
attrvalue
)
)
k
=
k
+
l
k
=
k
+
l
j
=
j
+
1
j
=
j
+
1
try
:
try
:
...
@@ -253,7 +253,7 @@ class SGMLParser:
...
@@ -253,7 +253,7 @@ class SGMLParser:
# Example -- handle entity reference, no need to override
# Example -- handle entity reference, no need to override
def
handle_entityref
(
self
,
name
):
def
handle_entityref
(
self
,
name
):
table
=
self
.
__class__
.
entitydefs
table
=
self
.
entitydefs
name
=
string
.
lower
(
name
)
name
=
string
.
lower
(
name
)
if
table
.
has_key
(
name
):
if
table
.
has_key
(
name
):
self
.
handle_data
(
table
[
name
])
self
.
handle_data
(
table
[
name
])
...
@@ -318,4 +318,5 @@ def test():
...
@@ -318,4 +318,5 @@ def test():
x
.
feed
(
line
)
x
.
feed
(
line
)
#test()
if
__name__
==
'__main__'
:
test
()
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