Skip to content

Commit 2219106

Browse files
Apply suggestions from code review
Co-authored-by: Ezio Melotti <[email protected]>
1 parent c8429be commit 2219106

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Doc/library/html.parser.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML.
2020
Create a parser instance able to parse invalid markup.
2121

2222
If *convert_charrefs* is ``True`` (the default), all character
23-
references (except the ones in ``script``/``style`` elements) are
23+
references (except the ones in RAWTEXT tags) are
2424
automatically converted to the corresponding Unicode characters.
2525

26-
If *scripting* is true, the ``noscript`` element is parsed in the
27-
RAWTEXT mode.
26+
If *scripting* is false (the default), the content of the ``noscript`` element
27+
is parsed normally; if it's true, it's parsed in RAWTEXT mode.
2828

2929
An :class:`.HTMLParser` instance is fed HTML data and calls handler methods
3030
when start tags, end tags, text, comments, and other markup elements are

Lib/html/parser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class HTMLParser(_markupbase.ParserBase):
129129

130130
# See the HTML5 specs section "13.4 Parsing HTML fragments".
131131
# https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
132+
# CDATA_CONTENT_ELEMENTS are parsed in RAWTEXT mode
132133
CDATA_CONTENT_ELEMENTS = ("script", "style", "xmp", "iframe", "noembed", "noframes")
133134
RCDATA_CONTENT_ELEMENTS = ("textarea", "title")
134135

@@ -138,8 +139,9 @@ def __init__(self, *, convert_charrefs=True, scripting=False):
138139
If convert_charrefs is true (the default), all character references
139140
are automatically converted to the corresponding Unicode characters.
140141
141-
If scripting is true, the noscript element is parsed in the
142-
RAWTEXT mode.
142+
If *scripting* is false (the default), the content of the
143+
``noscript`` element is parsed normally; if it's true,
144+
it's parsed in RAWTEXT mode.
143145
"""
144146
super().__init__()
145147
self.convert_charrefs = convert_charrefs

0 commit comments

Comments
 (0)