Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1d4c0e80
Commit
1d4c0e80
authored
Sep 22, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added verbose option; added ismap/align/width/height to handle_image args
parent
2f713359
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
Lib/htmllib.py
Lib/htmllib.py
+12
-4
No files found.
Lib/htmllib.py
View file @
1d4c0e80
...
...
@@ -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
...
...
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