summaryrefslogtreecommitdiffstats
path: root/Doc/library/html.parser.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-05-10 09:01:23 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-05-10 09:01:23 (GMT)
commitdba903993a8d3e13d2cf83d6a8912e908025b17b (patch)
treeb0f7d957452d40ce384e5d0a1382067e3379f60f /Doc/library/html.parser.rst
parent387235085c5a6a1d823b0af3fabb42830c88f984 (diff)
downloadcpython-dba903993a8d3e13d2cf83d6a8912e908025b17b.zip
cpython-dba903993a8d3e13d2cf83d6a8912e908025b17b.tar.gz
cpython-dba903993a8d3e13d2cf83d6a8912e908025b17b.tar.bz2
Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
Diffstat (limited to 'Doc/library/html.parser.rst')
-rw-r--r--Doc/library/html.parser.rst10
1 files changed, 9 insertions, 1 deletions
diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst
index a084d3d..2f93c0b 100644
--- a/Doc/library/html.parser.rst
+++ b/Doc/library/html.parser.rst
@@ -51,8 +51,10 @@ as they are encountered::
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print("Encountered a start tag:", tag)
+
def handle_endtag(self, tag):
print("Encountered an end tag :", tag)
+
def handle_data(self, data):
print("Encountered some data :", data)
@@ -237,21 +239,27 @@ examples::
print("Start tag:", tag)
for attr in attrs:
print(" attr:", attr)
+
def handle_endtag(self, tag):
print("End tag :", tag)
+
def handle_data(self, data):
print("Data :", data)
+
def handle_comment(self, data):
print("Comment :", data)
+
def handle_entityref(self, name):
c = chr(name2codepoint[name])
print("Named ent:", c)
+
def handle_charref(self, name):
if name.startswith('x'):
c = chr(int(name[1:], 16))
else:
c = chr(int(name))
print("Num ent :", c)
+
def handle_decl(self, data):
print("Decl :", data)
@@ -283,7 +291,7 @@ further parsing::
attr: ('type', 'text/css')
Data : #python { color: green }
End tag : style
- >>>
+
>>> parser.feed('<script type="text/javascript">'
... 'alert("<strong>hello!</strong>");</script>')
Start tag: script