Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9087b7f

Browse files
committed
Merged revisions 63438 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r63438 | georg.brandl | 2008-05-17 23:54:03 +0200 (Sat, 17 May 2008) | 3 lines Rename html.parser file, and split html.entities from htmllib to ease removal of the latter in Py3k. ........
1 parent bf93b04 commit 9087b7f

4 files changed

Lines changed: 39 additions & 40 deletions

File tree

Doc/library/html.entities.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
:mod:`html.entities` --- Definitions of HTML general entities
2+
=============================================================
3+
4+
.. module:: html.entities
5+
:synopsis: Definitions of HTML general entities.
6+
.. sectionauthor:: Fred L. Drake, Jr. <[email protected]>
7+
8+
9+
This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``,
10+
and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to
11+
provide the :attr:`entitydefs` member of the :class:`html.parser.HTMLParser`
12+
class. The definition provided here contains all the entities defined by XHTML
13+
1.0 that can be handled using simple textual substitution in the Latin-1
14+
character set (ISO-8859-1).
15+
16+
17+
.. data:: entitydefs
18+
19+
A dictionary mapping XHTML 1.0 entity definitions to their replacement text in
20+
ISO Latin-1.
21+
22+
23+
.. data:: name2codepoint
24+
25+
A dictionary that maps HTML entity names to the Unicode codepoints.
26+
27+
28+
.. data:: codepoint2name
29+
30+
A dictionary that maps Unicode codepoints to HTML entity names.
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
21
:mod:`html.parser` --- Simple HTML and XHTML parser
32
===================================================
43

54
.. module:: html.parser
65
:synopsis: A simple parser that can handle HTML and XHTML.
76

87

9-
.. index:: HTML, XHTML
8+
.. index::
9+
single: HTML
10+
single: XHTML
1011

1112
This module defines a class :class:`HTMLParser` which serves as the basis for
1213
parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML.
@@ -87,8 +88,8 @@ An exception is defined as well:
8788
HREF="http://www.cwi.nl/">``, this method would be called as
8889
``handle_starttag('a', [('href', 'http://www.cwi.nl/')])``.
8990

90-
All entity references from :mod:`html.entities` are replaced in the
91-
attribute values.
91+
All entity references from :mod:`html.entities` are replaced in the attribute
92+
values.
9293

9394

9495
.. method:: HTMLParser.handle_startendtag(tag, attrs)
@@ -171,8 +172,8 @@ As a basic example, below is a very basic HTML parser that uses the
171172
class MyHTMLParser(HTMLParser):
172173

173174
def handle_starttag(self, tag, attrs):
174-
print("Encountered the beginning of a %s tag" % tag)
175+
print "Encountered the beginning of a %s tag" % tag
175176

176177
def handle_endtag(self, tag):
177-
print("Encountered the end of a %s tag" % tag)
178+
print "Encountered the end of a %s tag" % tag
178179

Doc/library/htmllib.rst

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -145,36 +145,3 @@ additional methods and instance variables for use within tag methods.
145145
call to :meth:`save_bgn`. If the :attr:`nofill` flag is false, whitespace is
146146
collapsed to single spaces. A call to this method without a preceding call to
147147
:meth:`save_bgn` will raise a :exc:`TypeError` exception.
148-
149-
150-
:mod:`html.entities` --- Definitions of HTML general entities
151-
=============================================================
152-
153-
.. module:: html.entities
154-
:synopsis: Definitions of HTML general entities.
155-
.. sectionauthor:: Fred L. Drake, Jr. <[email protected]>
156-
157-
158-
This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``,
159-
and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to
160-
provide the :attr:`entitydefs` member of the :class:`HTMLParser` class. The
161-
definition provided here contains all the entities defined by XHTML 1.0 that
162-
can be handled using simple textual substitution in the Latin-1 character set
163-
(ISO-8859-1).
164-
165-
166-
.. data:: entitydefs
167-
168-
A dictionary mapping XHTML 1.0 entity definitions to their replacement text in
169-
ISO Latin-1.
170-
171-
172-
.. data:: name2codepoint
173-
174-
A dictionary that maps HTML entity names to the Unicode codepoints.
175-
176-
177-
.. data:: codepoint2name
178-
179-
A dictionary that maps Unicode codepoints to HTML entity names.
180-

Doc/library/markup.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ definition of the Python bindings for the DOM and SAX interfaces.
2121

2222
.. toctree::
2323

24-
htmlparser.rst
24+
html.parser.rst
25+
html.entities.rst
2526
sgmllib.rst
2627
htmllib.rst
2728
pyexpat.rst

0 commit comments

Comments
 (0)