mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
This commit is contained in:
parent
387235085c
commit
dba903993a
63 changed files with 445 additions and 409 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue