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. |
Terry Jan Reedy | fa089b9 | 2016-06-11 15:02:54 -0400 | [diff] [blame] | 6 | |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 7 | .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org> |
| 8 | |
Raymond Hettinger | a199368 | 2011-01-27 01:20:32 +0000 | [diff] [blame] | 9 | **Source code:** :source:`Lib/html/entities.py` |
| 10 | |
| 11 | -------------- |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 12 | |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame] | 13 | This module defines four dictionaries, :data:`html5`, |
| 14 | :data:`name2codepoint`, :data:`codepoint2name`, and :data:`entitydefs`. |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 15 | |
| 16 | |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame] | 17 | .. data:: html5 |
| 18 | |
| 19 | A dictionary that maps HTML5 named character references [#]_ to the |
| 20 | equivalent Unicode character(s), e.g. ``html5['gt;'] == '>'``. |
| 21 | Note that the trailing semicolon is included in the name (e.g. ``'gt;'``), |
| 22 | however some of the names are accepted by the standard even without the |
| 23 | semicolon: in this case the name is present with and without the ``';'``. |
Ezio Melotti | 4a9ee26 | 2013-11-19 20:28:45 +0200 | [diff] [blame] | 24 | See also :func:`html.unescape`. |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame] | 25 | |
| 26 | .. versionadded:: 3.3 |
| 27 | |
| 28 | |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 29 | .. data:: entitydefs |
| 30 | |
| 31 | A dictionary mapping XHTML 1.0 entity definitions to their replacement text in |
| 32 | ISO Latin-1. |
| 33 | |
| 34 | |
| 35 | .. data:: name2codepoint |
| 36 | |
Georg Brandl | 3be472b | 2015-01-14 08:26:30 +0100 | [diff] [blame] | 37 | A dictionary that maps HTML entity names to the Unicode code points. |
Georg Brandl | 9087b7f | 2008-05-18 07:53:01 +0000 | [diff] [blame] | 38 | |
| 39 | |
| 40 | .. data:: codepoint2name |
| 41 | |
Georg Brandl | 3be472b | 2015-01-14 08:26:30 +0100 | [diff] [blame] | 42 | A dictionary that maps Unicode code points to HTML entity names. |
Ezio Melotti | dc44f55 | 2012-06-24 04:37:41 +0200 | [diff] [blame] | 43 | |
| 44 | |
| 45 | .. rubric:: Footnotes |
| 46 | |
Serhiy Storchaka | 6dff020 | 2016-05-07 10:49:07 +0300 | [diff] [blame] | 47 | .. [#] See https://www.w3.org/TR/html5/syntax.html#named-character-references |