FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

revert creation of the html.entities and html.parser modules · python-emscripten/cpython@d995e11 · GitHub

Repository navigation

Commit d995e11

Browse files
committed
revert creation of the html.entities and html.parser modules
(http://bugs.python.org/issue2882)
1 parent 1f60af8 commit d995e11

15 files changed

Lines changed: 722 additions & 90 deletions

‎Doc/library/html.entities.rst‎

Lines changed: 0 additions & 42 deletions
This file was deleted.

‎Doc/library/htmllib.rst‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ The module defines a parser class and an exception:
7777
Interface definition for transforming an abstract flow of formatting events into
7878
specific output events on writer objects.
7979

80-
Module :mod:`html.parser`
80+
Module :mod:`HTMLParser`
8181
Alternate HTML parser that offers a slightly lower-level view of the input, but
8282
is designed to work with XHTML, and does not implement some of the SGML syntax
8383
not used in "HTML as deployed" and which isn't legal for XHTML.
8484

85-
Module :mod:`html.entities`
85+
Module :mod:`htmlentitydefs`
8686
Definition of replacement text for XHTML 1.0 entities.
8787

8888
Module :mod:`sgmllib`
@@ -147,3 +147,44 @@ additional methods and instance variables for use within tag methods.
147147
call to :meth:`save_bgn`. If the :attr:`nofill` flag is false, whitespace is
148148
collapsed to single spaces. A call to this method without a preceding call to
149149
:meth:`save_bgn` will raise a :exc:`TypeError` exception.
150+
151+
152+
:mod:`htmlentitydefs` --- Definitions of HTML general entities
153+
==============================================================
154+
155+
.. module:: htmlentitydefs
156+
:synopsis: Definitions of HTML general entities.
157+
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
158+
159+
.. note::
160+
The :mod:`htmlentitydefs` module has been renamed to :mod:`html.entities` in
161+
Python 3.0.
162+
163+
164+
This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``,
165+
and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to
166+
provide the :attr:`entitydefs` member of the :class:`HTMLParser` class. The
167+
definition provided here contains all the entities defined by XHTML 1.0 that
168+
can be handled using simple textual substitution in the Latin-1 character set
169+
(ISO-8859-1).
170+
171+
172+
.. data:: entitydefs
173+
174+
A dictionary mapping XHTML 1.0 entity definitions to their replacement text in
175+
ISO Latin-1.
176+
177+
178+
.. data:: name2codepoint
179+
180+
A dictionary that maps HTML entity names to the Unicode codepoints.
181+
182+
.. versionadded:: 2.3
183+
184+
185+
.. data:: codepoint2name
186+
187+
A dictionary that maps Unicode codepoints to HTML entity names.
188+
189+
.. versionadded:: 2.3
190+
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
:mod:`html.parser` --- Simple HTML and XHTML parser
2-
===================================================
31

4-
.. module:: HTMLParser
5-
:synopsis: Old name for the html.parser module.
2+
:mod:`HTMLParser` --- Simple HTML and XHTML parser
3+
==================================================
64

7-
.. module:: html.parser
5+
.. module:: HTMLParser
86
:synopsis: A simple parser that can handle HTML and XHTML.
97

108
.. note::
11-
The :mod:`HTMLParser` module has been renamed to :mod:`html.parser` in Python
12-
3.0. It is importable under both names in Python 2.6 and the rest of the 2.x
13-
series.
9+
The :mod:`HTMLParser` module has been renamed to
10+
:mod:`html.parser` in Python 3.0.
1411

1512

1613
.. versionadded:: 2.2
@@ -99,8 +96,8 @@ An exception is defined as well:
9996
``handle_starttag('a', [('href', 'http://www.cwi.nl/')])``.
10097

10198
.. versionchanged:: 2.6
102-
All entity references from :mod:`html.entities` are now replaced in the
103-
attribute values.
99+
All entity references from :mod:`htmlentitydefs` are now replaced in the attribute
100+
values.
104101

105102

106103
.. method:: HTMLParser.handle_startendtag(tag, attrs)
@@ -178,7 +175,7 @@ Example HTML Parser Application
178175
As a basic example, below is a very basic HTML parser that uses the
179176
:class:`HTMLParser` class to print out tags as they are encountered::
180177

181-
from html.parser import HTMLParser
178+
from HTMLParser import HTMLParser
182179

183180
class MyHTMLParser(HTMLParser):
184181

‎Doc/library/markup.rst‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ definition of the Python bindings for the DOM and SAX interfaces.
2323

2424
.. toctree::
2525

26-
html.parser.rst
27-
html.entities.rst
26+
htmlparser.rst
2827
sgmllib.rst
2928
htmllib.rst
3029
pyexpat.rst

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL