Skip to content

Translate library/html.parser.po #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 107 additions & 21 deletions library/html.parser.po
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2022, Python Software Foundation
# Copyright (C) 2001-2023, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Matt Wang <mattwang44@gmail.com>, 2023
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-09 00:15+0000\n"
"PO-Revision-Date: 2018-05-23 16:03+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"POT-Creation-Date: 2022-02-18 00:10+0000\n"
"PO-Revision-Date: 2023-05-04 22:54+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.2.2\n"

#: ../../library/html.parser.rst:2
msgid ":mod:`html.parser` --- Simple HTML and XHTML parser"
msgstr ""
msgstr ":mod:`html.parser` --- 簡單的 HTML 和 XHTML 剖析器"

#: ../../library/html.parser.rst:7
msgid "**Source code:** :source:`Lib/html/parser.py`"
Expand All @@ -32,17 +33,21 @@ msgid ""
"for parsing text files formatted in HTML (HyperText Mark-up Language) and "
"XHTML."
msgstr ""
"該模組定義了一個類別 :class:`HTMLParser`,是剖析 (parse) HTML(HyperText "
"Mark-up Language、超文本標記語言)和 XHTML 格式文本檔案的基礎。"

#: ../../library/html.parser.rst:20
msgid "Create a parser instance able to parse invalid markup."
msgstr ""
msgstr "建立一個能夠剖析無效標記的剖析器實例。"

#: ../../library/html.parser.rst:22
msgid ""
"If *convert_charrefs* is ``True`` (the default), all character references "
"(except the ones in ``script``/``style`` elements) are automatically "
"converted to the corresponding Unicode characters."
msgstr ""
"如果 *convert_charrefs* 為 ``True`` (預設值),所有字元參照 (reference)"
"( ``script``/``style`` 元素中的參照除外)將自動轉換為相應的 Unicode 字元。"

#: ../../library/html.parser.rst:26
msgid ""
Expand All @@ -51,51 +56,62 @@ msgid ""
"encountered. The user should subclass :class:`.HTMLParser` and override its "
"methods to implement the desired behavior."
msgstr ""
":class:`.HTMLParser` 實例被提供 HTML 資料,並在遇到開始標籤、結束標籤、文本、"
"註解和其他標記元素時呼叫處理程式 (handler) 方法。使用者應該繼承 :class:`."
"HTMLParser` 並覆蓋其方法以實作所需的行為。"

#: ../../library/html.parser.rst:31
msgid ""
"This parser does not check that end tags match start tags or call the end-"
"tag handler for elements which are closed implicitly by closing an outer "
"element."
msgstr ""
"此剖析器不檢查結束標籤是否與開始標籤匹配,也不會為透過結束外部元素來隱晦地被"
"結束的元素呼叫結束標籤處理程式。"

#: ../../library/html.parser.rst:34
msgid "*convert_charrefs* keyword argument added."
msgstr ""
msgstr "新增關鍵字引數 *convert_charrefs*。"

#: ../../library/html.parser.rst:37
msgid "The default value for argument *convert_charrefs* is now ``True``."
msgstr ""
msgstr "引數 *convert_charrefs* 的預設值現在是 ``True``。"

#: ../../library/html.parser.rst:42
msgid "Example HTML Parser Application"
msgstr ""
msgstr "HTML 剖析器應用程式範例"

#: ../../library/html.parser.rst:44
msgid ""
"As a basic example, below is a simple HTML parser that uses the :class:"
"`HTMLParser` class to print out start tags, end tags, and data as they are "
"encountered::"
msgstr ""
"以下的基礎範例是一個簡單的 HTML 剖析器,它使用 :class:`HTMLParser` 類別,當遇"
"到開始標籤、結束標籤和資料時將它們印出:\n"
"\n"
"::"

#: ../../library/html.parser.rst:64
msgid "The output will then be:"
msgstr ""
msgstr "輸出將是:"

#: ../../library/html.parser.rst:83
msgid ":class:`.HTMLParser` Methods"
msgstr ""
msgstr ":class:`.HTMLParser` 方法"

#: ../../library/html.parser.rst:85
msgid ":class:`HTMLParser` instances have the following methods:"
msgstr ""
msgstr ":class:`HTMLParser` 實例具有以下方法:"

#: ../../library/html.parser.rst:90
msgid ""
"Feed some text to the parser. It is processed insofar as it consists of "
"complete elements; incomplete data is buffered until more data is fed or :"
"meth:`close` is called. *data* must be :class:`str`."
msgstr ""
"向剖析器提供一些文本。只要它由完整的元素組成,它就會被處理;不完整的資料會被"
"緩衝,直到輸入更多資料或呼叫 :meth:`close`。 *data* 必須是 :class:`str`。"

#: ../../library/html.parser.rst:97
msgid ""
Expand All @@ -104,16 +120,19 @@ msgid ""
"additional processing at the end of the input, but the redefined version "
"should always call the :class:`HTMLParser` base class method :meth:`close`."
msgstr ""
"強制處理所有緩衝資料,如同它後面跟有文件結束標籤一樣。此方法可能有被衍生類別"
"重新定義,以在輸入末尾定義額外的處理,但重新定義的版本仍應要呼叫 :class:"
"`HTMLParser` 基底類別方法 :meth:`close`。"

#: ../../library/html.parser.rst:105
msgid ""
"Reset the instance. Loses all unprocessed data. This is called implicitly "
"at instantiation time."
msgstr ""
msgstr "重置實例。丟棄所有未處理的資料。這在實例化時被會隱晦地呼叫。"

#: ../../library/html.parser.rst:111
msgid "Return current line number and offset."
msgstr ""
msgstr "回傳當前列號 (line number) 和偏移量 (offset)。"

#: ../../library/html.parser.rst:116
msgid ""
Expand All @@ -122,6 +141,9 @@ msgid ""
"with HTML \"as deployed\" or for re-generating input with minimal changes "
"(whitespace between attributes can be preserved, etc.)."
msgstr ""
"回傳最近開啟 (open) 的開始標籤的文本。這對於結構化處理通常不必要,但在處理"
"「已部署」的 HTML 或以最少的更改重新生成輸入(可以保留屬性之間的空白等)時可"
"能很有用。"

#: ../../library/html.parser.rst:122
msgid ""
Expand All @@ -130,12 +152,14 @@ msgid ""
"class implementations do nothing (except for :meth:`~HTMLParser."
"handle_startendtag`):"
msgstr ""
"當遇到資料或標記元素時將呼叫以下方法,並且它們應在子類別中被覆蓋。基底類別實"
"作什麼都不做(除了 :meth:`~HTMLParser.handle_startendtag`):"

#: ../../library/html.parser.rst:129
msgid ""
"This method is called to handle the start tag of an element (e.g. ``<div "
"id=\"main\">``)."
msgstr ""
msgstr "呼叫此方法來處理元素的開始標籤(例如 ``<div id=\"main\">``)。"

#: ../../library/html.parser.rst:131
msgid ""
Expand All @@ -145,28 +169,33 @@ msgid ""
"translated to lower case, and quotes in the *value* have been removed, and "
"character and entity references have been replaced."
msgstr ""
"*tag* 引數是轉換為小寫的標籤名稱。 *attrs* 引數是一個 ``(name, value)`` 對的"
"列表,包含在標籤的 ``<>`` 括號內找到的屬性。 *name* 將被轉成小寫,*value* 中"
"的引號會被刪除,字元和實體參照也會被替換。"

#: ../../library/html.parser.rst:137
msgid ""
"For instance, for the tag ``<A HREF=\"https://www.cwi.nl/\">``, this method "
"would be called as ``handle_starttag('a', [('href', 'https://www.cwi."
"nl/')])``."
msgstr ""
"例如,對於標籤 ``<A HREF=\"https://www.cwi.nl/\">``,這個方法會以 "
"``handle_starttag('a', [('href', 'https://www.cwi.nl/')])`` 的形式被呼叫。"

#: ../../library/html.parser.rst:140
msgid ""
"All entity references from :mod:`html.entities` are replaced in the "
"attribute values."
msgstr ""
msgstr "在屬性值中來自 :mod:`html.entities` 的所有實體參照都會被替換。"

#: ../../library/html.parser.rst:146
msgid ""
"This method is called to handle the end tag of an element (e.g. ``</div>``)."
msgstr ""
msgstr "呼叫此方法來處理元素的結束標籤(例如 ``</div>``)。"

#: ../../library/html.parser.rst:148
msgid "The *tag* argument is the name of the tag converted to lower case."
msgstr ""
msgstr "*tag* 引數是轉換為小寫的標籤名稱。"

#: ../../library/html.parser.rst:153
msgid ""
Expand All @@ -176,19 +205,28 @@ msgid ""
"implementation simply calls :meth:`handle_starttag` and :meth:"
"`handle_endtag`."
msgstr ""
"與 :meth:`handle_starttag` 類似,但在剖析器遇到 XHTML 樣式的空標籤 "
"(``<img ... />``) 時呼叫。這個方法可能被需要這個特定詞彙資訊 (lexical "
"information) 的子類別覆蓋;預設實作只是呼叫 :meth:`handle_starttag` 和 :meth:"
"`handle_endtag`。"

#: ../../library/html.parser.rst:161
msgid ""
"This method is called to process arbitrary data (e.g. text nodes and the "
"content of ``<script>...</script>`` and ``<style>...</style>``)."
msgstr ""
"呼叫此方法來處理任意資料(例如文本節點與 ``<script>...</script>`` 和 "
"``<style>...</style>`` 的內容)。"

#: ../../library/html.parser.rst:167
msgid ""
"This method is called to process a named character reference of the form "
"``&name;`` (e.g. ``&gt;``), where *name* is a general entity reference (e.g. "
"``'gt'``). This method is never called if *convert_charrefs* is ``True``."
msgstr ""
"呼叫此方法來處理形式為 ``&name;`` (例如 ``&gt;``)的附名字元參照,其中 "
"*name* 是一般實體參照(例如 ``'gt'``)。如果 *convert_charrefs* 為 ``True``,"
"則永遠不會呼叫此方法。"

#: ../../library/html.parser.rst:175
msgid ""
Expand All @@ -198,18 +236,24 @@ msgid ""
"in this case the method will receive ``'62'`` or ``'x3E'``. This method is "
"never called if *convert_charrefs* is ``True``."
msgstr ""
"呼叫此方法來處理 ``#NNN;`` 和 ``&#xNNN;`` 形式的十進位和十六進位數字字元參"
"照。例如,``&gt;`` 的十進位等效為 ``&#62;``,而十六進位為 ``&#x3E;``;在這種"
"情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。如果 *convert_charrefs* 為 "
"``True``,則永遠不會呼叫此方法。"

#: ../../library/html.parser.rst:184
msgid ""
"This method is called when a comment is encountered (e.g. ``<!--comment--"
">``)."
msgstr ""
msgstr "當遇到註解時呼叫此方法(例如 ``<!--comment-->``)。"

#: ../../library/html.parser.rst:186
msgid ""
"For example, the comment ``<!-- comment -->`` will cause this method to be "
"called with the argument ``' comment '``."
msgstr ""
"舉例來說,註解 ``<!-- comment -->`` 會使得此方法被以引數 ``' comment '`` 來呼"
"叫。"

#: ../../library/html.parser.rst:189
msgid ""
Expand All @@ -218,18 +262,25 @@ msgid ""
"[endif]-->``, this method will receive ``'[if IE 9]>IE9-specific content<!"
"[endif]'``."
msgstr ""
"Internet Explorer 條件式註解(conditional comments, condcoms)的內容也會被發"
"送到這個方法,故以 ``<!--[if IE 9]>IE9-specific content<![endif]-->`` 為例,"
"這個方法將會收到 ``'[if IE 9]>IE9-specific content<![endif]'``。"

#: ../../library/html.parser.rst:196
msgid ""
"This method is called to handle an HTML doctype declaration (e.g. ``<!"
"DOCTYPE html>``)."
msgstr ""
"呼叫此方法來處理 HTML 文件類型聲明 (doctype declaration)(例如 ``<!DOCTYPE "
"html>``)。"

#: ../../library/html.parser.rst:199
msgid ""
"The *decl* parameter will be the entire contents of the declaration inside "
"the ``<!...>`` markup (e.g. ``'DOCTYPE html'``)."
msgstr ""
"*decl* 參數將是 ``<!...>`` 標記內聲明部分的全部內容(例如 ``'DOCTYPE "
"html'``)。"

#: ../../library/html.parser.rst:205
msgid ""
Expand All @@ -239,25 +290,33 @@ msgid ""
"called as ``handle_pi(\"proc color='red'\")``. It is intended to be "
"overridden by a derived class; the base class implementation does nothing."
msgstr ""
"遇到處理指示 (processing instruction) 時會呼叫的方法。 *data* 參數將包含整個"
"處理指示。例如,對於處理指示 ``<?proc color='red'>``,這個方法將以 "
"``handle_pi(\"proc color='red'\")`` 形式被呼叫。它旨在被衍生類別覆蓋;基底類"
"別實作中什麼都不做。"

#: ../../library/html.parser.rst:213
msgid ""
"The :class:`HTMLParser` class uses the SGML syntactic rules for processing "
"instructions. An XHTML processing instruction using the trailing ``'?'`` "
"will cause the ``'?'`` to be included in *data*."
msgstr ""
":class:`HTMLParser` 類別使用 SGML 語法規則來處理指示。使用有 ``?`` 跟隨在後面"
"的 XHTML 處理指示將導致 ``?`` 被包含在 *data* 中。"

#: ../../library/html.parser.rst:220
msgid ""
"This method is called when an unrecognized declaration is read by the parser."
msgstr ""
msgstr "當剖析器讀取無法識別的聲明時會呼叫此方法。"

#: ../../library/html.parser.rst:222
msgid ""
"The *data* parameter will be the entire contents of the declaration inside "
"the ``<![...]>`` markup. It is sometimes useful to be overridden by a "
"derived class. The base class implementation does nothing."
msgstr ""
"*data* 參數將是 ``<![...]>`` 標記內聲明的全部內容。有時被衍生類別被覆蓋會是好"
"用的。在基底類別實作中什麼都不做。"

#: ../../library/html.parser.rst:230
msgid "Examples"
Expand All @@ -268,41 +327,68 @@ msgid ""
"The following class implements a parser that will be used to illustrate more "
"examples::"
msgstr ""
"以下類別實作了一個剖析器,將用於解說更多範例:\n"
"\n"
"::"

#: ../../library/html.parser.rst:269
msgid "Parsing a doctype::"
msgstr ""
"剖析文件類型:\n"
"\n"
"::"

#: ../../library/html.parser.rst:275
msgid "Parsing an element with a few attributes and a title::"
msgstr ""
"剖析一個具有一些屬性和標題的元素:\n"
"\n"
"::"

#: ../../library/html.parser.rst:287
msgid ""
"The content of ``script`` and ``style`` elements is returned as is, without "
"further parsing::"
msgstr ""
"``script`` 和 ``style`` 元素的內容按原樣回傳,無需進一步剖析:\n"
"\n"
"::"

#: ../../library/html.parser.rst:303
msgid "Parsing comments::"
msgstr ""
"剖析註解:\n"
"\n"
"::"

#: ../../library/html.parser.rst:310
msgid ""
"Parsing named and numeric character references and converting them to the "
"correct char (note: these 3 references are all equivalent to ``'>'``)::"
msgstr ""
"剖析附名 (named) 且為數值的 (numeric) 字元參照,並將它們轉換為正確的字元(注"
"意:這 3 個參照都等同於 ``'>'``):\n"
"\n"
"::"

#: ../../library/html.parser.rst:318
msgid ""
"Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but :meth:"
"`~HTMLParser.handle_data` might be called more than once (unless "
"*convert_charrefs* is set to ``True``)::"
msgstr ""
"將不完整的區塊提供給 :meth:`~HTMLParser.feed` 是可行的,但是 :meth:"
"`~HTMLParser.handle_data` 可能會被多次呼叫(除非 *convert_charrefs* 設定為 "
"``True``):\n"
"\n"
"::"

#: ../../library/html.parser.rst:331
msgid "Parsing invalid HTML (e.g. unquoted attributes) also works::"
msgstr ""
"也能夠剖析無效的 HTML(例如未加引號的屬性):\n"
"\n"
"::"

#: ../../library/html.parser.rst:9
msgid "HTML"
Expand Down