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
cf9e27c7
Kaydet (Commit)
cf9e27c7
authored
Eyl 01, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
support value-less attributes, using regex.group()
üst
fd504d9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
sgmllib.py
Lib/sgmllib.py
+8
-14
No files found.
Lib/sgmllib.py
Dosyayı görüntüle @
cf9e27c7
...
@@ -173,8 +173,6 @@ class SGMLParser:
...
@@ -173,8 +173,6 @@ 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]*'
)
# XXX Should also support value-less attributes (e.g. ISMAP)
# XXX Should use regex.group()
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
]*'
+
...
@@ -187,18 +185,12 @@ class SGMLParser:
...
@@ -187,18 +185,12 @@ class SGMLParser:
while
k
<
j
:
while
k
<
j
:
l
=
attrfind
.
match
(
rawdata
,
k
)
l
=
attrfind
.
match
(
rawdata
,
k
)
if
l
<
0
:
break
if
l
<
0
:
break
regs
=
attrfind
.
regs
attrname
,
rest
,
attrvalue
=
attrfind
.
group
(
1
,
2
,
3
)
a1
,
b1
=
regs
[
1
]
if
not
rest
:
a2
,
b2
=
regs
[
2
]
attrvalue
=
attrname
a3
,
b3
=
regs
[
3
]
elif
attrvalue
[:
1
]
==
'
\'
'
==
attrvalue
[
-
1
:]
or
\
attrname
=
rawdata
[
a1
:
b1
]
attrvalue
[:
1
]
==
'"'
==
attrvalue
[
-
1
:]:
if
'='
in
rawdata
[
k
:
k
+
l
]:
attrvalue
=
attrvalue
[
1
:
-
1
]
attrvalue
=
rawdata
[
a3
:
b3
]
if
attrvalue
[:
1
]
==
'
\'
'
==
attrvalue
[
-
1
:]
or
\
attrvalue
[:
1
]
==
'"'
==
attrvalue
[
-
1
:]:
attrvalue
=
attrvalue
[
1
:
-
1
]
else
:
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
...
@@ -226,6 +218,8 @@ class SGMLParser:
...
@@ -226,6 +218,8 @@ class SGMLParser:
except
AttributeError
:
except
AttributeError
:
self
.
unknown_endtag
(
tag
)
self
.
unknown_endtag
(
tag
)
return
return
# XXX Should invoke end methods when popping their
# XXX stack entry, not when encountering the tag!
if
self
.
stack
and
self
.
stack
[
-
1
]
==
tag
:
if
self
.
stack
and
self
.
stack
[
-
1
]
==
tag
:
del
self
.
stack
[
-
1
]
del
self
.
stack
[
-
1
]
else
:
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