Skip to content

Commit dc44f55

Browse files
committed
#11113: add a new "html5" dictionary containing the named character references defined by the HTML5 standard and the equivalent Unicode character(s) to the html.entities module.
1 parent b698d8e commit dc44f55

File tree

3 files changed

+2259
-2
lines changed

3 files changed

+2259
-2
lines changed

Doc/library/html.entities.rst

+19-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,25 @@
99

1010
--------------
1111

12-
This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``,
13-
and ``entitydefs``. ``entitydefs`` is used to provide the :attr:`entitydefs`
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`
1415
attribute of the :class:`html.parser.HTMLParser` class. The definition provided
1516
here contains all the entities defined by XHTML 1.0 that can be handled using
1617
simple textual substitution in the Latin-1 character set (ISO-8859-1).
1718

1819

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+
1931
.. data:: entitydefs
2032

2133
A dictionary mapping XHTML 1.0 entity definitions to their replacement text in
@@ -30,3 +42,8 @@ simple textual substitution in the Latin-1 character set (ISO-8859-1).
3042
.. data:: codepoint2name
3143

3244
A dictionary that maps Unicode codepoints to HTML entity names.
45+
46+
47+
.. rubric:: Footnotes
48+
49+
.. [#] See http://www.w3.org/TR/html5/named-character-references.html

0 commit comments

Comments
 (0)