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
fd504d9f
Commit
fd504d9f
authored
Sep 01, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
took out forms support (in favor a Grail extension)
parent
a89b1bad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
94 deletions
+3
-94
Lib/htmllib.py
Lib/htmllib.py
+3
-94
No files found.
Lib/htmllib.py
View file @
fd504d9f
...
...
@@ -48,7 +48,9 @@ class HTMLParser(SGMLParser):
def
save_end
(
self
):
data
=
self
.
savedata
self
.
savedata
=
None
return
string
.
join
(
string
.
split
(
data
))
if
not
self
.
nofill
:
data
=
string
.
join
(
string
.
split
(
data
))
return
data
# --- Hooks for anchors; should probably be overridden
...
...
@@ -67,36 +69,6 @@ class HTMLParser(SGMLParser):
def
handle_image
(
self
,
src
,
alt
):
self
.
handle_data
(
alt
)
# --- Hooks for forms; should probably be overridden
def
form_bgn
(
self
,
action
,
method
,
enctype
):
self
.
do_p
([])
self
.
handle_data
(
"<FORM>"
)
def
form_end
(
self
):
self
.
handle_data
(
"</FORM>"
)
self
.
do_p
([])
def
handle_input
(
self
,
type
,
options
):
self
.
handle_data
(
"<INPUT>"
)
def
select_bgn
(
self
,
name
,
size
,
multiple
):
self
.
handle_data
(
"<SELECT>"
)
def
select_end
(
self
):
self
.
handle_data
(
"</SELECT>"
)
def
handle_option
(
self
,
value
,
selected
):
self
.
handle_data
(
"<OPTION>"
)
def
textarea_bgn
(
self
,
name
,
rows
,
cols
):
self
.
handle_data
(
"<TEXTAREA>"
)
self
.
start_pre
([])
def
textarea_end
(
self
):
self
.
end_pre
()
self
.
handle_data
(
"</TEXTAREA>"
)
# --------- Top level elememts
def
start_html
(
self
,
attrs
):
pass
...
...
@@ -387,69 +359,6 @@ class HTMLParser(SGMLParser):
src
=
value
self
.
handle_image
(
src
,
alt
)
# ------ Forms
def
start_form
(
self
,
attrs
):
action
=
''
method
=
''
enctype
=
''
for
a
,
v
in
attrs
:
if
a
==
'action'
:
action
=
v
if
a
==
'method'
:
method
=
v
if
a
==
'enctype'
:
enctype
=
v
self
.
form_bgn
(
action
,
method
,
enctype
)
def
end_form
(
self
):
self
.
form_end
()
def
do_input
(
self
,
attrs
):
type
=
''
options
=
{}
for
a
,
v
in
attrs
:
if
a
==
'type'
:
type
=
string
.
lower
(
v
)
else
:
options
[
a
]
=
v
self
.
handle_input
(
type
,
options
)
def
start_select
(
self
,
attrs
):
name
=
''
size
=
0
multiple
=
0
for
a
,
v
in
attrs
:
if
a
==
'multiple'
:
multiple
=
1
if
a
==
'name'
:
name
=
v
if
a
==
'size'
:
try
:
size
=
string
.
atoi
(
size
)
except
:
pass
self
.
select_bgn
(
name
,
size
,
multiple
)
def
end_select
(
self
):
self
.
select_end
()
def
do_option
(
self
,
attrs
):
value
=
''
selected
=
1
for
a
,
v
in
attrs
:
if
a
==
'value'
:
value
=
v
if
a
==
'selected'
:
selected
=
1
self
.
handle_option
(
value
,
selected
)
def
start_textarea
(
self
,
attrs
):
name
=
''
rows
=
0
cols
=
0
for
a
,
v
in
attrs
:
if
a
==
'name'
:
name
=
v
if
a
==
'rows'
:
try
:
rows
=
string
.
atoi
(
v
)
except
:
pass
if
a
==
'cols'
:
try
:
cols
=
string
.
atoi
(
v
)
except
:
pass
self
.
textarea_bgn
(
name
,
rows
,
cols
)
def
end_textarea
(
self
):
self
.
textarea_end
()
# --- Really Old Unofficial Deprecated Stuff
def
do_plaintext
(
self
,
attrs
):
...
...
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