[Python-checkins] python/dist/src/Tools/webchecker README, 1.2,
1.3 webchecker.py, 1.30, 1.31
akuchling at users.sourceforge.net
akuchling at users.sourceforge.net
Sun Mar 21 14:07:40 EST 2004
Update of /cvsroot/python/python/dist/src/Tools/webchecker
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1228
Modified Files:
README webchecker.py
Log Message:
[Patch #918212] Support XHTML's 'id' attribute, which can be on any element.
Index: README
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** README 17 Nov 1999 15:41:47 -0000 1.2
--- README 21 Mar 2004 19:07:23 -0000 1.3
***************
*** 19,20 ****
--- 19,23 ----
into webchecker.py, and corresponding mods to wcgui.py and
websucker.py.
+
+ - Mar 2004. Chris Herborth contributed a patch to let webchecker.py
+ handle XHTML's 'id' attribute.
Index: webchecker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** webchecker.py 27 Feb 2003 06:59:10 -0000 1.30
--- webchecker.py 21 Mar 2004 19:07:23 -0000 1.31
***************
*** 785,819 ****
sgmllib.SGMLParser.__init__(self)
! def start_a(self, attributes):
! self.link_attr(attributes, 'href')
!
! # We must rescue the NAME
# attributes from the anchor, in order to
# cache the internal anchors which are made
# available in the page.
for name, value in attributes:
! if name == "name":
if value in self.names:
! self.checker.message("WARNING: duplicate name %s in %s",
value, self.url)
else: self.names.append(value)
break
def end_a(self): pass
def do_area(self, attributes):
self.link_attr(attributes, 'href')
def do_body(self, attributes):
self.link_attr(attributes, 'background', 'bgsound')
def do_img(self, attributes):
self.link_attr(attributes, 'src', 'lowsrc')
def do_frame(self, attributes):
self.link_attr(attributes, 'src', 'longdesc')
def do_iframe(self, attributes):
self.link_attr(attributes, 'src', 'longdesc')
def do_link(self, attributes):
--- 785,833 ----
sgmllib.SGMLParser.__init__(self)
! def check_name_id( self, attributes ):
! """ Check the name or id attributes on an element.
! """
! # We must rescue the NAME or id (name is deprecated in XHTML)
# attributes from the anchor, in order to
# cache the internal anchors which are made
# available in the page.
for name, value in attributes:
! if name == "name" or name == "id":
if value in self.names:
! self.checker.message("WARNING: duplicate ID name %s in %s",
value, self.url)
else: self.names.append(value)
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 do_area(self, attributes):
self.link_attr(attributes, 'href')
+ self.check_name_id(attributes)
def do_body(self, attributes):
self.link_attr(attributes, 'background', 'bgsound')
+ self.check_name_id(attributes)
def do_img(self, attributes):
self.link_attr(attributes, 'src', 'lowsrc')
+ self.check_name_id(attributes)
def do_frame(self, attributes):
self.link_attr(attributes, 'src', 'longdesc')
+ self.check_name_id(attributes)
def do_iframe(self, attributes):
self.link_attr(attributes, 'src', 'longdesc')
+ self.check_name_id(attributes)
def do_link(self, attributes):
***************
*** 825,846 ****
--- 839,867 ----
self.link_attr(attributes, "href")
break
+ self.check_name_id(attributes)
def do_object(self, attributes):
self.link_attr(attributes, 'data', 'usemap')
+ self.check_name_id(attributes)
def do_script(self, attributes):
self.link_attr(attributes, 'src')
+ self.check_name_id(attributes)
def do_table(self, attributes):
self.link_attr(attributes, 'background')
+ self.check_name_id(attributes)
def do_td(self, attributes):
self.link_attr(attributes, 'background')
+ self.check_name_id(attributes)
def do_th(self, attributes):
self.link_attr(attributes, 'background')
+ self.check_name_id(attributes)
def do_tr(self, attributes):
self.link_attr(attributes, 'background')
+ self.check_name_id(attributes)
def link_attr(self, attributes, *args):
***************
*** 858,861 ****
--- 879,883 ----
self.checker.note(1, " Base %s", value)
self.base = value
+ self.check_name_id(attributes)
def getlinks(self):
More information about the Python-checkins
mailing list