@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version :Python 3.10\n "
1313"Report-Msgid-Bugs-To :\n "
14- "POT-Creation-Date :2025-01-03 16:02 +0000\n "
14+ "POT-Creation-Date :2025-10-31 17:16 +0000\n "
1515"PO-Revision-Date :2025-09-22 15:58+0000\n "
1616"Last-Translator :python-doc bot, 2025\n "
1717"Language-Team :Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -42,15 +42,20 @@ msgstr "创建一个能解析无效标记的解析器实例。"
4242
4343#: ../../library/html.parser.rst:22
4444msgid ""
45- "If *convert_charrefs* is``True`` (the default), all character references "
46- "(except the ones in ``script``/ ``style`` elements ) are automatically "
47- "converted to the corresponding Unicode characters."
45+ "If *convert_charrefs* istrue (the default), all character references "
46+ "(except the ones inelements like ``script`` and ``style``) are "
47+ "automatically converted to the corresponding Unicode characters."
4848msgstr ""
49- "如果 *convert_charrefs* 为 ``True`` (默认值),则所有字符引用( ``script``/``style`` "
50- "元素中的除外)都会自动转换为相应的 Unicode 字符。"
5149
5250#: ../../library/html.parser.rst:26
5351msgid ""
52+ "If *scripting* is false (the default), the content of the ``noscript`` "
53+ "element is parsed normally; if it's true, it's returned as is without being "
54+ "parsed."
55+ msgstr ""
56+
57+ #: ../../library/html.parser.rst:30
58+ msgid ""
5459"An :class:`.HTMLParser` instance is fed HTML data and calls handler methods "
5560"when start tags, end tags, text, comments, and other markup elements are "
5661"encountered. The user should subclass :class:`.HTMLParser` and override its"
@@ -60,46 +65,50 @@ msgstr ""
6065"数据,并在标记开始、标记结束、文本、注释和其他元素标记出现的时候调用对应的方法。要实现具体的行为,请使用 :class:`.HTMLParser` "
6166"的子类并重写其方法。"
6267
63- #: ../../library/html.parser.rst:31
68+ #: ../../library/html.parser.rst:35
6469msgid ""
6570"This parser does not check that end tags match start tags or call the end-"
6671"tag handler for elements which are closed implicitly by closing an outer "
6772"element."
6873msgstr "这个解析器不检查结束标记是否与开始标记匹配,也不会因外层元素完毕而隐式关闭了的元素引发结束标记处理。"
6974
70- #: ../../library/html.parser.rst:34
75+ #: ../../library/html.parser.rst:38
7176msgid "*convert_charrefs* keyword argument added."
7277msgstr "*convert_charrefs* 关键字参数被添加。"
7378
74- #: ../../library/html.parser.rst:37
79+ #: ../../library/html.parser.rst:41
7580msgid "The default value for argument *convert_charrefs* is now ``True``."
7681msgstr "*convert_charrefs* 参数的默认值现在为 ``True``。"
7782
78- #: ../../library/html.parser.rst:42
83+ #: ../../library/html.parser.rst:44
84+ msgid "Added the *scripting* parameter."
85+ msgstr ""
86+
87+ #: ../../library/html.parser.rst:49
7988msgid "Example HTML Parser Application"
8089msgstr "HTML 解析器的示例程序"
8190
82- #: ../../library/html.parser.rst:44
91+ #: ../../library/html.parser.rst:51
8392msgid ""
8493"As a basic example, below is a simple HTML parser that uses the "
8594":class:`HTMLParser` class to print out start tags, end tags, and data as "
8695"they are encountered::"
8796msgstr ""
8897"下面是简单的 HTML 解析器的一个基本示例,使用 :class:`HTMLParser` 类,当遇到开始标记、结束标记以及数据的时候将内容打印出来。"
8998
90- #: ../../library/html.parser.rst:64
99+ #: ../../library/html.parser.rst:71
91100msgid "The output will then be:"
92101msgstr "输出是:"
93102
94- #: ../../library/html.parser.rst:83
103+ #: ../../library/html.parser.rst:90
95104msgid ":class:`.HTMLParser` Methods"
96105msgstr ":class:`.HTMLParser` 方法"
97106
98- #: ../../library/html.parser.rst:85
107+ #: ../../library/html.parser.rst:92
99108msgid ":class:`HTMLParser` instances have the following methods:"
100109msgstr ":class:`HTMLParser` 实例有下列方法:"
101110
102- #: ../../library/html.parser.rst:90
111+ #: ../../library/html.parser.rst:97
103112msgid ""
104113"Feed some text to the parser. It is processed insofar as it consists of "
105114"complete elements; incomplete data is buffered until more data is fed or "
@@ -108,7 +117,7 @@ msgstr ""
108117"填充一些文本到解析器中。如果包含完整的元素,则被处理;如果数据不完整,将被缓冲直到更多的数据被填充,或者 :meth:`close` "
109118"被调用。*data* 必须为 :class:`str` 类型。"
110119
111- #: ../../library/html.parser.rst:97
120+ #: ../../library/html.parser.rst:104
112121msgid ""
113122"Force processing of all buffered data as if it were followed by an end-of-"
114123"file mark. This method may be redefined by a derived class to define "
@@ -118,17 +127,17 @@ msgstr ""
118127"如同后面跟着一个文件结束标记一样,强制处理所有缓冲数据。这个方法能被派生类重新定义,用于在输入的末尾定义附加处理,但是重定义的版本应当始终调用基类 "
119128":class:`HTMLParser` 的 :meth:`close` 方法。"
120129
121- #: ../../library/html.parser.rst:105
130+ #: ../../library/html.parser.rst:112
122131msgid ""
123132"Reset the instance. Loses all unprocessed data. This is called implicitly "
124133"at instantiation time."
125134msgstr "重置实例。丢失所有未处理的数据。在实例化阶段被隐式调用。"
126135
127- #: ../../library/html.parser.rst:111
136+ #: ../../library/html.parser.rst:118
128137msgid "Return current line number and offset."
129138msgstr "返回当前行号和偏移值。"
130139
131- #: ../../library/html.parser.rst:116
140+ #: ../../library/html.parser.rst:123
132141msgid ""
133142"Return the text of the most recently opened start tag. This should not "
134143"normally be needed for structured processing, but may be useful in dealing "
@@ -138,7 +147,7 @@ msgstr ""
138147"返回最近打开的开始标记中的文本。 结构化处理时通常应该不需要这个,但在处理“已部署”的 HTML "
139148"或是在以最小改变来重新生成输入时可能会有用处(例如可以保留属性间的空格等)。"
140149
141- #: ../../library/html.parser.rst:122
150+ #: ../../library/html.parser.rst:129
142151msgid ""
143152"The following methods are called when data or markup elements are "
144153"encountered and they are meant to be overridden in a subclass. The base "
@@ -148,13 +157,13 @@ msgstr ""
148157"下列方法将在遇到数据或者标记元素的时候被调用。他们需要在子类中重写。基类的实现中没有任何实际操作(除了 "
149158":meth:`~HTMLParser.handle_startendtag` ):"
150159
151- #: ../../library/html.parser.rst:129
160+ #: ../../library/html.parser.rst:136
152161msgid ""
153162"This method is called to handle the start tag of an element (e.g. ``<div "
154163"id=\" main\" >``)."
155164msgstr "调用此方法来处理一个元素的开始标记 (例如 ``<div id=\" main\" >``)。"
156165
157- #: ../../library/html.parser.rst:131
166+ #: ../../library/html.parser.rst:138
158167msgid ""
159168"The *tag* argument is the name of the tag converted to lower case. The "
160169"*attrs* argument is a list of ``(name, value)`` pairs containing the "
@@ -165,7 +174,7 @@ msgstr ""
165174"*tag* 参数是小写的标记名。*attrs* 参数是一个 ``(name, value)`` 形式的列表,包含了所有在标记的 ``<>`` "
166175"括号中找到的属性。*name* 转换为小写,*value* 的引号被去除,字符和实体引用都会被替换。"
167176
168- #: ../../library/html.parser.rst:137
177+ #: ../../library/html.parser.rst:144
169178msgid ""
170179"For instance, for the tag ``<A HREF=\" https://www.cwi.nl/\" >``, this method "
171180"would be called as ``handle_starttag('a', [('href', "
@@ -174,22 +183,22 @@ msgstr ""
174183"实例中,对于标签 ``<A HREF=\" https://www.cwi.nl/\" >``,这个方法将以下列形式被调用 "
175184"``handle_starttag('a', [('href', 'https://www.cwi.nl/')])`` 。"
176185
177- #: ../../library/html.parser.rst:140
186+ #: ../../library/html.parser.rst:147
178187msgid ""
179188"All entity references from :mod:`html.entities` are replaced in the "
180189"attribute values."
181190msgstr ":mod:`html.entities` 中的所有实体引用,会被替换为属性值。"
182191
183- #: ../../library/html.parser.rst:146
192+ #: ../../library/html.parser.rst:153
184193msgid ""
185194"This method is called to handle the end tag of an element (e.g. ``</div>``)."
186195msgstr "此方法被用来处理元素的结束标记(例如: ``</div>`` )。"
187196
188- #: ../../library/html.parser.rst:148
197+ #: ../../library/html.parser.rst:155
189198msgid "The *tag* argument is the name of the tag converted to lower case."
190199msgstr "*tag* 参数是小写的标签名。"
191200
192- #: ../../library/html.parser.rst:153
201+ #: ../../library/html.parser.rst:160
193202msgid ""
194203"Similar to :meth:`handle_starttag`, but called when the parser encounters an"
195204" XHTML-style empty tag (``<img ... />``). This method may be overridden by "
@@ -201,48 +210,41 @@ msgstr ""
201210"/>``)。这个方法能被需要这种特殊词法信息的子类重写;默认实现仅简单调用 :meth:`handle_starttag` 和 "
202211":meth:`handle_endtag` 。"
203212
204- #: ../../library/html.parser.rst:161
213+ #: ../../library/html.parser.rst:168
205214msgid ""
206215"This method is called to process arbitrary data (e.g. text nodes and the "
207- "content of``< script>...</script> `` and ``< style>...</style> ``)."
216+ "content ofelements like `` script`` and ``style``)."
208217msgstr ""
209- "这个方法被用来处理任意数据(例如:文本节点和 ``<script>...</script>`` 以及 ``<style>...</style>`` "
210- "中的内容)。"
211218
212- #: ../../library/html.parser.rst:167
219+ #: ../../library/html.parser.rst:174
213220msgid ""
214221"This method is called to process a named character reference of the form "
215222"``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g."
216- " ``'gt'``). This method isnever called if *convert_charrefs* is``True`` ."
223+ " ``'gt'``). This method isonly called if *convert_charrefs* isfalse ."
217224msgstr ""
218- "这个方法被用于处理 ``&name;`` 形式的命名字符引用(例如 ``>``),其中 *name* 是通用的实体引用(例如: "
219- "``'gt'``)。如果 *convert_charrefs* 为 ``True``,该方法永远不会被调用。"
220225
221- #: ../../library/html.parser.rst:175
226+ #: ../../library/html.parser.rst:182
222227msgid ""
223228"This method is called to process decimal and hexadecimal numeric character "
224229"references of the form ``&#NNN;`` and ``&#xNNN;``. For example, the decimal"
225230" equivalent for ``>`` is ``>``, whereas the hexadecimal is "
226- "``>``; in this case the method will receive ``'62'`` or ``'x3E'``. "
227- "This method isnever called if *convert_charrefs* is``True`` ."
231+ "``>``; in this case the method will receive ``'62'`` or ``'x3E'``.This "
232+ " method isonly called if *convert_charrefs* isfalse ."
228233msgstr ""
229- "这个方法被用来处理 ``&#NNN;`` 和 ``&#xNNN;`` 形式的十进制和十六进制字符引用。例如,``>`` 等效的十进制形式为 "
230- "``>`` ,而十六进制形式为 ``>`` ;在这种情况下,方法将收到 ``'62'`` 或 ``'x3E'`` 。如果 "
231- "*convert_charrefs* 为 ``True`` ,则该方法永远不会被调用。"
232234
233- #: ../../library/html.parser.rst:184
235+ #: ../../library/html.parser.rst:191
234236msgid ""
235237"This method is called when a comment is encountered (e.g. ``<!--"
236238"comment-->``)."
237239msgstr "这个方法在遇到注释的时候被调用(例如: ``<!--comment-->`` )。"
238240
239- #: ../../library/html.parser.rst:186
241+ #: ../../library/html.parser.rst:193
240242msgid ""
241243"For example, the comment ``<!-- comment -->`` will cause this method to be "
242244"called with the argument ``' comment '``."
243245msgstr "例如, ``<!-- comment -->`` 这个注释会用 ``' comment '`` 作为参数调用此方法。"
244246
245- #: ../../library/html.parser.rst:189
247+ #: ../../library/html.parser.rst:196
246248msgid ""
247249"The content of Internet Explorer conditional comments (condcoms) will also "
248250"be sent to this method, so, for ``<!--[if IE 9]>IE9-specific "
@@ -253,19 +255,19 @@ msgstr ""
253255"9]>IE9-specific content<![endif]-->`` ,这个方法将接收到 ``'[if IE 9]>IE9-specific "
254256"content<![endif]'`` 。"
255257
256- #: ../../library/html.parser.rst:196
258+ #: ../../library/html.parser.rst:203
257259msgid ""
258260"This method is called to handle an HTML doctype declaration (e.g. "
259261"``<!DOCTYPE html>``)."
260262msgstr "这个方法用来处理 HTML doctype 申明(例如 ``<!DOCTYPE html>`` )。"
261263
262- #: ../../library/html.parser.rst:199
264+ #: ../../library/html.parser.rst:206
263265msgid ""
264266"The *decl* parameter will be the entire contents of the declaration inside "
265267"the ``<!...>`` markup (e.g. ``'DOCTYPE html'``)."
266268msgstr "*decl* 形参为 ``<!...>`` 标记中的所有内容(例如: ``'DOCTYPE html'`` )。"
267269
268- #: ../../library/html.parser.rst:205
270+ #: ../../library/html.parser.rst:212
269271msgid ""
270272"Method called when a processing instruction is encountered. The *data* "
271273"parameter will contain the entire processing instruction. For example, for "
@@ -276,7 +278,7 @@ msgstr ""
276278"此方法在遇到处理指令的时候被调用。*data* 形参将包含整个处理指令。例如,对于处理指令 ``<?proc color='red'>`` "
277279",这个方法将以 ``handle_pi(\" proc color='red'\" )`` 形式被调用。它旨在被派生类重写;基类实现中无任何实际操作。"
278280
279- #: ../../library/html.parser.rst:213
281+ #: ../../library/html.parser.rst:220
280282msgid ""
281283"The :class:`HTMLParser` class uses the SGML syntactic rules for processing "
282284"instructions. An XHTML processing instruction using the trailing ``'?'`` "
@@ -285,62 +287,60 @@ msgstr ""
285287":class:`HTMLParser` 类使用 SGML 语法规则处理指令。使用 ``'?'`` 结尾的 XHTML 处理指令将导致 ``'?'`` "
286288"包含在 *data* 中。"
287289
288- #: ../../library/html.parser.rst:220
290+ #: ../../library/html.parser.rst:227
289291msgid ""
290292"This method is called when an unrecognized declaration is read by the "
291293"parser."
292294msgstr "当解析器读到无法识别的声明时,此方法被调用。"
293295
294- #: ../../library/html.parser.rst:222
296+ #: ../../library/html.parser.rst:229
295297msgid ""
296298"The *data* parameter will be the entire contents of the declaration inside "
297299"the ``<![...]>`` markup. It is sometimes useful to be overridden by a "
298300"derived class. The base class implementation does nothing."
299301msgstr "*data* 形参为 ``<![...]>`` 标记中的所有内容。某些时候对派生类的重写很有用。基类实现中无任何实际操作。"
300302
301- #: ../../library/html.parser.rst:230
303+ #: ../../library/html.parser.rst:237
302304msgid "Examples"
303305msgstr "例子"
304306
305- #: ../../library/html.parser.rst:232
307+ #: ../../library/html.parser.rst:239
306308msgid ""
307309"The following class implements a parser that will be used to illustrate more"
308310" examples::"
309311msgstr "下面的类实现了一个解析器,用于更多示例的演示::"
310312
311- #: ../../library/html.parser.rst:269
313+ #: ../../library/html.parser.rst:276
312314msgid "Parsing a doctype::"
313315msgstr "解析一个文档类型声明::"
314316
315- #: ../../library/html.parser.rst:275
317+ #: ../../library/html.parser.rst:282
316318msgid "Parsing an element with a few attributes and a title::"
317319msgstr "解析一个具有一些属性和标题的元素::"
318320
319- #: ../../library/html.parser.rst:287
321+ #: ../../library/html.parser.rst:294
320322msgid ""
321- "The content of ``script`` and ``style``elements is returned as is, without "
322- "further parsing::"
323- msgstr "``script`` 和 ``style`` 元素中的内容原样返回,无需进一步解析:: "
323+ "The content ofelements like ``script`` and ``style`` is returned as is, "
324+ "without further parsing::"
325+ msgstr ""
324326
325- #: ../../library/html.parser.rst:303
327+ #: ../../library/html.parser.rst:310
326328msgid "Parsing comments::"
327329msgstr "解析注释::"
328330
329- #: ../../library/html.parser.rst:310
331+ #: ../../library/html.parser.rst:317
330332msgid ""
331333"Parsing named and numeric character references and converting them to the "
332334"correct char (note: these 3 references are all equivalent to ``'>'``)::"
333335msgstr "解析命名或数字形式的字符引用,并把他们转换到正确的字符(注意:这 3 种转义都是 ``'>'`` )::"
334336
335- #: ../../library/html.parser.rst:318
337+ #: ../../library/html.parser.rst:325
336338msgid ""
337339"Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but "
338- ":meth:`~HTMLParser.handle_data` might be called more than once(unless "
339- "*convert_charrefs* isset to ``True``) ::"
340+ ":meth:`~HTMLParser.handle_data` might be called more than onceif "
341+ "*convert_charrefs* isfalse ::"
340342msgstr ""
341- "填充不完整的块给 :meth:`~HTMLParser.feed` 执行,:meth:`~HTMLParser.handle_data` "
342- "可能会多次调用(除非 *convert_charrefs* 被设置为 ``True`` )::"
343343
344- #: ../../library/html.parser.rst:331
344+ #: ../../library/html.parser.rst:338
345345msgid "Parsing invalid HTML (e.g. unquoted attributes) also works::"
346346msgstr "解析无效的 HTML (例如:未引用的属性)也能正常运行::"