diff options
| author | Guido van Rossum <guido@python.org> | 1995-09-22 00:55:50 +0000 | 
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1995-09-22 00:55:50 +0000 | 
| commit | 453534a84d51b96a77424a1a292b9ef37803e433 (patch) | |
| tree | bd04e74adc22f0147fd51d25c7143b8bf25a58cc | |
| parent | 3c0bfd0deeadccf10c8982d5b42dd39f63fb727e (diff) | |
| download | cpython-git-453534a84d51b96a77424a1a292b9ef37803e433.tar.gz | |
added verbose option; added ismap/align/width/height to handle_image args
| -rw-r--r-- | Lib/htmllib.py | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/htmllib.py b/Lib/htmllib.py index 2d82c77241..3288ce8860 100644 --- a/Lib/htmllib.py +++ b/Lib/htmllib.py @@ -14,8 +14,8 @@ from formatter import AS_IS  class HTMLParser(SGMLParser): -    def __init__(self, formatter): -        SGMLParser.__init__(self) +    def __init__(self, formatter, verbose=0): +        SGMLParser.__init__(self, verbose)          self.formatter = formatter          self.savedata = None          self.isindex = 0 @@ -66,7 +66,7 @@ class HTMLParser(SGMLParser):      # --- Hook for images; should probably be overridden -    def handle_image(self, src, alt): +    def handle_image(self, src, alt, *args):          self.handle_data(alt)      # --------- Top level elememts @@ -348,6 +348,8 @@ class HTMLParser(SGMLParser):          alt = '(image)'          ismap = ''          src = '' +	width = 0 +	height = 0          for attrname, value in attrs:              if attrname == 'align':                  align = value @@ -357,7 +359,13 @@ class HTMLParser(SGMLParser):                  ismap = value              if attrname == 'src':                  src = value -        self.handle_image(src, alt) +	    if attrname == 'width': +		try: width = string.atoi(value) +		except: pass +	    if attrname == 'height': +		try: height = string.atoi(value) +		except: pass +        self.handle_image(src, alt, ismap, align, width, height)      # --- Really Old Unofficial Deprecated Stuff  | 
