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
a982c445
Kaydet (Commit)
a982c445
authored
Mar 21, 2004
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[Patch #918212] Support XHTML's 'id' attribute, which can be on any element.
üst
4c4a45de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
README
Tools/webchecker/README
+3
-0
webchecker.py
Tools/webchecker/webchecker.py
+28
-6
No files found.
Tools/webchecker/README
Dosyayı görüntüle @
a982c445
...
@@ -18,3 +18,6 @@ other options.
...
@@ -18,3 +18,6 @@ other options.
- Nov 1999. Sam Bayer contributed patches to reintegrate wcnew.py
- Nov 1999. Sam Bayer contributed patches to reintegrate wcnew.py
into webchecker.py, and corresponding mods to wcgui.py and
into webchecker.py, and corresponding mods to wcgui.py and
websucker.py.
websucker.py.
- Mar 2004. Chris Herborth contributed a patch to let webchecker.py
handle XHTML's 'id' attribute.
Tools/webchecker/webchecker.py
Dosyayı görüntüle @
a982c445
...
@@ -784,37 +784,51 @@ class MyHTMLParser(sgmllib.SGMLParser):
...
@@ -784,37 +784,51 @@ class MyHTMLParser(sgmllib.SGMLParser):
self
.
url
=
url
self
.
url
=
url
sgmllib
.
SGMLParser
.
__init__
(
self
)
sgmllib
.
SGMLParser
.
__init__
(
self
)
def
start_a
(
self
,
attributes
):
def
check_name_id
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'href'
)
""" Check the name or id attributes on an element.
"""
# We must rescue the NAME
# We must rescue the NAME
or id (name is deprecated in XHTML)
# attributes from the anchor, in order to
# attributes from the anchor, in order to
# cache the internal anchors which are made
# cache the internal anchors which are made
# available in the page.
# available in the page.
for
name
,
value
in
attributes
:
for
name
,
value
in
attributes
:
if
name
==
"name"
:
if
name
==
"name"
or
name
==
"id"
:
if
value
in
self
.
names
:
if
value
in
self
.
names
:
self
.
checker
.
message
(
"WARNING: duplicate name
%
s in
%
s"
,
self
.
checker
.
message
(
"WARNING: duplicate
ID
name
%
s in
%
s"
,
value
,
self
.
url
)
value
,
self
.
url
)
else
:
self
.
names
.
append
(
value
)
else
:
self
.
names
.
append
(
value
)
break
break
def
unknown_starttag
(
self
,
tag
,
attributes
):
""" In XHTML, you can have id attributes on any element.
"""
self
.
check_name_id
(
attributes
)
def
start_a
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'href'
)
self
.
check_name_id
(
attributes
)
def
end_a
(
self
):
pass
def
end_a
(
self
):
pass
def
do_area
(
self
,
attributes
):
def
do_area
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'href'
)
self
.
link_attr
(
attributes
,
'href'
)
self
.
check_name_id
(
attributes
)
def
do_body
(
self
,
attributes
):
def
do_body
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'background'
,
'bgsound'
)
self
.
link_attr
(
attributes
,
'background'
,
'bgsound'
)
self
.
check_name_id
(
attributes
)
def
do_img
(
self
,
attributes
):
def
do_img
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'src'
,
'lowsrc'
)
self
.
link_attr
(
attributes
,
'src'
,
'lowsrc'
)
self
.
check_name_id
(
attributes
)
def
do_frame
(
self
,
attributes
):
def
do_frame
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'src'
,
'longdesc'
)
self
.
link_attr
(
attributes
,
'src'
,
'longdesc'
)
self
.
check_name_id
(
attributes
)
def
do_iframe
(
self
,
attributes
):
def
do_iframe
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'src'
,
'longdesc'
)
self
.
link_attr
(
attributes
,
'src'
,
'longdesc'
)
self
.
check_name_id
(
attributes
)
def
do_link
(
self
,
attributes
):
def
do_link
(
self
,
attributes
):
for
name
,
value
in
attributes
:
for
name
,
value
in
attributes
:
...
@@ -824,24 +838,31 @@ class MyHTMLParser(sgmllib.SGMLParser):
...
@@ -824,24 +838,31 @@ class MyHTMLParser(sgmllib.SGMLParser):
or
parts
==
[
"alternate"
,
"stylesheet"
]):
or
parts
==
[
"alternate"
,
"stylesheet"
]):
self
.
link_attr
(
attributes
,
"href"
)
self
.
link_attr
(
attributes
,
"href"
)
break
break
self
.
check_name_id
(
attributes
)
def
do_object
(
self
,
attributes
):
def
do_object
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'data'
,
'usemap'
)
self
.
link_attr
(
attributes
,
'data'
,
'usemap'
)
self
.
check_name_id
(
attributes
)
def
do_script
(
self
,
attributes
):
def
do_script
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'src'
)
self
.
link_attr
(
attributes
,
'src'
)
self
.
check_name_id
(
attributes
)
def
do_table
(
self
,
attributes
):
def
do_table
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'background'
)
self
.
link_attr
(
attributes
,
'background'
)
self
.
check_name_id
(
attributes
)
def
do_td
(
self
,
attributes
):
def
do_td
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'background'
)
self
.
link_attr
(
attributes
,
'background'
)
self
.
check_name_id
(
attributes
)
def
do_th
(
self
,
attributes
):
def
do_th
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'background'
)
self
.
link_attr
(
attributes
,
'background'
)
self
.
check_name_id
(
attributes
)
def
do_tr
(
self
,
attributes
):
def
do_tr
(
self
,
attributes
):
self
.
link_attr
(
attributes
,
'background'
)
self
.
link_attr
(
attributes
,
'background'
)
self
.
check_name_id
(
attributes
)
def
link_attr
(
self
,
attributes
,
*
args
):
def
link_attr
(
self
,
attributes
,
*
args
):
for
name
,
value
in
attributes
:
for
name
,
value
in
attributes
:
...
@@ -857,6 +878,7 @@ class MyHTMLParser(sgmllib.SGMLParser):
...
@@ -857,6 +878,7 @@ class MyHTMLParser(sgmllib.SGMLParser):
if
self
.
checker
:
if
self
.
checker
:
self
.
checker
.
note
(
1
,
" Base
%
s"
,
value
)
self
.
checker
.
note
(
1
,
" Base
%
s"
,
value
)
self
.
base
=
value
self
.
base
=
value
self
.
check_name_id
(
attributes
)
def
getlinks
(
self
):
def
getlinks
(
self
):
return
self
.
links
.
keys
()
return
self
.
links
.
keys
()
...
...
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