blob: f0dd7aae8fe34150ef422b5eb2a0fad7ec37c01f [file] [log] [blame]
Georg Brandl9087b7f2008-05-18 07:53:01 +00001: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 Hettingera1993682011-01-27 01:20:32 +00008**Source code:** :source:`Lib/html/entities.py`
9
10--------------
Georg Brandl9087b7f2008-05-18 07:53:01 +000011
Ezio Melottidc44f552012-06-24 04:37:41 +020012This 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 Kumarana6bac952011-07-04 11:28:30 -070015attribute of the :class:`html.parser.HTMLParser` class. The definition provided
Georg Brandl877b10a2008-06-01 21:25:55 +000016here contains all the entities defined by XHTML 1.0 that can be handled using
17simple textual substitution in the Latin-1 character set (ISO-8859-1).
Georg Brandl9087b7f2008-05-18 07:53:01 +000018
19
Ezio Melottidc44f552012-06-24 04:37:41 +020020.. 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 Brandl9087b7f2008-05-18 07:53:01 +000031.. 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 Melottidc44f552012-06-24 04:37:41 +020045
46
47.. rubric:: Footnotes
48
49.. [#] See http://www.w3.org/TR/html5/named-character-references.html