| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1f60af8 commit d995e11
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,12 +77,12 @@ The module defines a parser class and an exception: | |||
| 77 | 77 | Interface definition for transforming an abstract flow of formatting events into | |
| 78 | 78 | specific output events on writer objects. | |
| 79 | 79 | ||
| 80 | - Module :mod:`html.parser` | ||
| 80 | + Module :mod:`HTMLParser` | ||
| 81 | 81 | Alternate HTML parser that offers a slightly lower-level view of the input, but | |
| 82 | 82 | is designed to work with XHTML, and does not implement some of the SGML syntax | |
| 83 | 83 | not used in "HTML as deployed" and which isn't legal for XHTML. | |
| 84 | 84 | ||
| 85 | - Module :mod:`html.entities` | ||
| 85 | + Module :mod:`htmlentitydefs` | ||
| 86 | 86 | Definition of replacement text for XHTML 1.0 entities. | |
| 87 | 87 | ||
| 88 | 88 | Module :mod:`sgmllib` | |
@@ -147,3 +147,44 @@ additional methods and instance variables for use within tag methods. | |||
| 147 | 147 | call to :meth:`save_bgn`. If the :attr:`nofill` flag is false, whitespace is | |
| 148 | 148 | collapsed to single spaces. A call to this method without a preceding call to | |
| 149 | 149 | :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 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,13 @@ | |||
| 1 | - :mod:`html.parser` --- Simple HTML and XHTML parser | ||
| 2 | - =================================================== | ||
| 3 | 1 | ||
| 4 | - .. module:: HTMLParser | ||
| 5 | - :synopsis: Old name for the html.parser module. | ||
| 2 | + :mod:`HTMLParser` --- Simple HTML and XHTML parser | ||
| 3 | + ================================================== | ||
| 6 | 4 | ||
| 7 | - .. module:: html.parser | ||
| 5 | + .. module:: HTMLParser | ||
| 8 | 6 | :synopsis: A simple parser that can handle HTML and XHTML. | |
| 9 | 7 | ||
| 10 | 8 | .. 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. | ||
| 14 | 11 | ||
| 15 | 12 | ||
| 16 | 13 | .. versionadded:: 2.2 | |
@@ -99,8 +96,8 @@ An exception is defined as well: | |||
| 99 | 96 | ``handle_starttag('a', [('href', 'http://www.cwi.nl/')])``. | |
| 100 | 97 | ||
| 101 | 98 | .. 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. | ||
| 104 | 101 | ||
| 105 | 102 | ||
| 106 | 103 | .. method:: HTMLParser.handle_startendtag(tag, attrs) | |
@@ -178,7 +175,7 @@ Example HTML Parser Application | |||
| 178 | 175 | As a basic example, below is a very basic HTML parser that uses the | |
| 179 | 176 | :class:`HTMLParser` class to print out tags as they are encountered:: | |
| 180 | 177 | ||
| 181 | - from html.parser import HTMLParser | ||
| 178 | + from HTMLParser import HTMLParser | ||
| 182 | 179 | ||
| 183 | 180 | class MyHTMLParser(HTMLParser): | |
| 184 | 181 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,8 +23,7 @@ definition of the Python bindings for the DOM and SAX interfaces. | |||
| 23 | 23 | ||
| 24 | 24 | .. toctree:: | |
| 25 | 25 | ||
| 26 | - html.parser.rst | ||
| 27 | - html.entities.rst | ||
| 26 | + htmlparser.rst | ||
| 28 | 27 | sgmllib.rst | |
| 29 | 28 | htmllib.rst | |
| 30 | 29 | pyexpat.rst | |
| Back | FazBrowse Home | New Git URL |
0 commit comments