Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 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. <fdrake@acm.org> |
| 7 | |
Raymond Hettinger | a199368 | 2011-01-27 01:20:32 +0000 | [diff] [blame] | 8 | **Source code:** :source:`Lib/html/entities.py` |
| 9 | |
| 10 | -------------- |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 11 | |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame^] | 12 | This module defines four dictionaries, :data:`html5`, |
| 13 | :data:`name2codepoint`, :data:`codepoint2name`, and :data:`entitydefs`. |
| 14 | :data:`entitydefs` is used to provide the :attr:`entitydefs` |
Senthil Kumaran | a6bac95 | 2011-07-04 11:28:30 -0700 | [diff] [blame] | 15 | attribute of the :class:`html.parser.HTMLParser` class. The definition provided |
Georg Brandl | 877b10a | 2008-06-01 21:25:55 +0000 | [diff] [blame] | 16 | here contains all the entities defined by XHTML 1.0 that can be handled using |
| 17 | simple textual substitution in the Latin-1 character set (ISO-8859-1). |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 18 | |
| 19 | |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame^] | 20 | .. data:: html5 |
| 21 | |
| 22 | A dictionary that maps HTML5 named character references [#]_ to the |
| 23 | equivalent Unicode character(s), e.g. ``html5['gt;'] == '>'``. |
| 24 | Note that the trailing semicolon is included in the name (e.g. ``'gt;'``), |
| 25 | however some of the names are accepted by the standard even without the |
| 26 | semicolon: in this case the name is present with and without the ``';'``. |
| 27 | |
| 28 | .. versionadded:: 3.3 |
| 29 | |
| 30 | |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 31 | .. data:: entitydefs |
| 32 | |
| 33 | A dictionary mapping XHTML 1.0 entity definitions to their replacement text in |
| 34 | ISO Latin-1. |
| 35 | |
| 36 | |
| 37 | .. data:: name2codepoint |
| 38 | |
| 39 | A dictionary that maps HTML entity names to the Unicode codepoints. |
| 40 | |
| 41 | |
| 42 | .. data:: codepoint2name |
| 43 | |
| 44 | A dictionary that maps Unicode codepoints to HTML entity names. |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame^] | 45 | |
| 46 | |
| 47 | .. rubric:: Footnotes |
| 48 | |
| 49 | .. [#] See http://www.w3.org/TR/html5/named-character-references.html |