local labels = {}
local raw_categories = {}
local raw_handlers = {}
-----------------------------------------------------------------------------
-- --
-- LABELS --
-- --
-----------------------------------------------------------------------------
labels["詞條維護"] = {
description = "正在被編輯者關注與改進的{{{langname}}}詞條,或含有{{{langname}}}術語的其他語言詞條。",
parents = {{name = "{{{langcat}}}", raw = true}},
umbrella_parents = "分類",
}
labels["entries without References header"] = {
description = "{{{langname}}} entries without a References header.",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
labels["entries without References or Further reading header"] = {
description = "{{{langname}}} entries without a References or Further reading header.",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
labels["entries that don't exist"] = {
description = "{{{langname}}} terms that do not meet the [[Wiktionary:Criteria for inclusion|criteria for inclusion]] (CFD). They are added to the category with the template {{temp|no entry|{{{langcode}}}}}.",
parents = {"詞條維護"},
}
labels["有詞源樹的詞條"] = {
description = "{{{langname}}} entries that display an etymology tree generated by the template {{tl|etymon}}.",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
labels["descendants to be fixed in desctree"] = {
description = "{{{langname}}} descendants to be fixed in desctree.",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
labels["詞請求"] = {
description = "Entries with [[Template:der]], [[Template:inh]], [[Template:m]] and similar templates lacking the parameter for linking to {{{langname}}} terms.",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
labels["紅鏈"] = {
description = "指向尚未建立的{{{langname}}}詞條的連結。",
parents = {"詞條維護"},
catfix = false,
can_be_empty = true,
hidden = true,
}
labels["紅鏈/l"] = {
description = "使用模板<code>{{[[Template:l|l]]}}</code>產生的{{{langname}}}紅鏈。",
parents = {"紅鏈"},
catfix = false,
can_be_empty = true,
hidden = true,
}
labels["紅鏈/m"] = {
description = "使用模板<code>{{[[Template:m|m]]}}</code>產生的{{{langname}}}紅鏈。",
parents = {"紅鏈"},
catfix = false,
can_be_empty = true,
hidden = true,
}
labels["紅鏈/t"] = {
description = "使用模板<code>{{[[Template:t|t]]}}</code>產生的{{{langname}}}紅鏈。",
parents = {"紅鏈"},
catfix = false,
can_be_empty = true,
hidden = true,
}
labels["紅鏈/t+"] = {
description = "使用模板<code>{{[[Template:t+|t+]]}}</code>產生的{{{langname}}}紅鏈。",
parents = {"紅鏈"},
catfix = false,
can_be_empty = true,
hidden = true,
}
labels["有國際音標的"] = {
description = "以國際音標形式給出發音的{{{langname}}}詞彙。關於與本分類相關的請求,請見[[:Category:{{{langname}}}詞條發音請求]]。",
parents = {"詞條維護"},
}
labels["有音頻鏈接的"] = {
description = "以音頻鏈接形式給出發音的{{{langname}}}詞彙。",
parents = {"詞條維護"},
}
labels["terms needing to be assigned to a sense"] = {
description = "{{{langname}}} entries that have terms under headers such as \"Synonyms\" or \"Antonyms\" not assigned to a specific sense of the entry in which they appear. Use [[Template:syn]] or [[Template:ant]] to fix these.",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
--[=[
labels["有變格表的"] = {
description = "{{{langname}}} entries that contain inflection tables. For requests related to this category, see [[:Category:Requests for inflections in {{{langname}}} entries]].",
parents = {"詞條維護"},
}
]=]
labels["有詞語搭配的"] = {
description = "含有用{{tl|co}}等模板添加詞語搭配的{{{langname}}}詞彙。",
-- additional = "For requests related to this category, see [[:Category:Requests for collocations in {{{langname}}}]]. See also [[:Category:Requests for quotations in {{{langname}}}]] and [[:Category:Requests for example sentences in {{{langname}}}]].",
parents = {"詞條維護"},
}
labels["有使用例的"] = {
description = "含有用[[Template:ux]]等模板添加的使用例或引文的{{{langname}}}詞彙。關於與本分類相關的請求,請見[[:Category:{{{langname}}}例句請求]]。另見[[:Category:{{{langname}}}引文請求]]。",
parents = {"詞條維護"},
}
labels["有引文的"] = {
description = "含有用[[Template:quote]]、[[Template:quote-book]]和[[Template:quote-journal]]等模板添加的引文的{{{langname}}}詞彙。關於與本分類相關的請求,請見[[:Category:{{{langname}}}引文請求]]。另見[[:Category:{{{langname}}}例句請求]]。",
parents = {"詞條維護"},
}
labels["標題行有紅鏈的詞"] = {
description = "在其標題行中包含紅色鏈接(即未創建的形式)的{{{langname}}}詞。",
parents = {"紅鏈"},
can_be_empty = true,
hidden = true,
}
labels["派生形式不詳的詞"] = {
description = "使用{{tl|undefined derivation}}的法語條目。這些條目應該使用更具體的詞源模板,例如{{tl|borrowed}}或{{tl|inherited}}。",
parents = {"詞條維護"},
can_be_empty = true,
hidden = true,
}
labels["terms with red links in their inflection tables"] = {
description = "{{{langname}}} terms that contain red links (i.e. uncreated forms) in their inflection tables.",
parents = {"redlinks"},
can_be_empty = true,
hidden = true,
}
for _, pos in ipairs({"名詞", "專有名詞", "動詞", "形容詞", "副詞", "分詞", "限定詞", "代詞", "數詞", "後綴"}) do
labels["標題行有紅鏈的" .. pos] = {
description = "在其標題行中包含紅色鏈接(即未創建的形式)的{{{langname}}}" .. pos .. "。",
parents = {"標題行有紅鏈的詞"},
breadcrumb = pos,
can_be_empty = true,
hidden = true,
}
labels[pos .. " with red links in their inflection tables"] = {
description = "{{{langname}}} " .. pos .. " that contain red links (i.e. uncreated forms) in their inflection tables.",
parents = {"terms with red links in their inflection tables"},
breadcrumb = pos,
can_be_empty = true,
hidden = true,
}
end
-- Add 'umbrella_parents' key if not already present.
for key, data in pairs(labels) do
if not data.umbrella_parents then
data.umbrella_parents = "詞條維護子分類"
end
end
-----------------------------------------------------------------------------
-- --
-- RAW CATEGORIES --
-- --
-----------------------------------------------------------------------------
raw_categories["詞條維護子分類"] = {
description = "Umbrella categories covering topics related to 詞條維護.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"綜合元分類",
{name = "詞條維護", is_label = true, sort = " "},
},
}
raw_categories["請求"] = {
intro = "{{shortcut|WT:CR|WT:RQ}}",
description = "各種請求分類的父分類。",
parents = {"Category:维基词典"},
}
raw_categories["各語言請求"] = {
description = "Categories with requests in various specific languages.",
additional = "{{{umbrella_msg}}}",
parents = {
{name = "請求子分類", sort = " "},
{name = "請求", sort = " "},
},
breadcrumb = "各語言",
}
raw_categories["請求子分類"] = {
description = "Umbrella categories covering topics related to requests.",
additional = "{{{umbrella_meta_msg}}}",
parents = {
"綜合元分類",
{name = "請求", sort = " "},
},
}
raw_categories["Requests for quotation by source"] = {
description = "Categories with requests for quotation, broken out by the source of the quotation.",
additional = "Some abbreviated names of sources are explained at [[Wiktionary:Abbreviated Authorities in Webster]].",
parents = {{name = "Requests for quotation", sort = "source"}},
breadcrumb = "By source",
}
raw_categories["Requests for quotation"] = {
-- FIXME
description = "Words are added to this category by the inclusion in their entries of {{temp|rfv-quote}}.",
parents = {{name = "Requests", sort = "quotation"}},
breadcrumb = "Quotation",
}
raw_categories["Requests for date by source"] = {
description = "Categories with requests for date, broken out by the source of the quotation whose date is sought.",
parents = {{name = "Requests for date", sort = "source"}},
breadcrumb = "By source",
}
raw_categories["Requests for date"] = {
-- FIXME, break date requests by language and make not-hidden
description = "Requests for a date to be added to a quotation.",
additional = "To add an article to this category, use {{temp|rfdate}} or {{temp|rfdatek}} to include the author. " ..
"Please remove the template from the article once the date has been provided. Articles are also added automatically by " ..
"templates such as {{temp|quote-book}} if the year= parameter is not provided. Providing the parameter in each case on " ..
"the page automatically removes the article from this category. See [[Wiktionary:Quotations]] for information about " ..
"formatting dates and quotations.",
parents = {{name = "Requests", sort = "date"}},
breadcrumb = "Date",
hidden = true,
}
-----------------------------------------------------------------------------
-- --
-- RAW HANDLERS --
-- --
-----------------------------------------------------------------------------
-- This array consists of category match specs. Each spec contains one or more properties, whose values are strings
-- that may contain references to other properties using the {{{PROPERTY}}} syntax. Each such spec should have at least
-- a `regex` property that matches the name of the category. Capturing groups in this regex can be referenced in other
-- properties using {{{1}}} for the first group, {{{2}}} for the second group, etc. Property expansion happens
-- recursively if needed (i.e. a property can reference another property, which in turn references a third property).
--
-- If there is a `language_name` propery, it specifies the language name (and will typically be a reference to a
-- capturing group from the `regex` property); if not specified, it defaults to "{{{1}}}" unless the `nolang` property
-- is set, in which case there is no language name derivable from the category name. The language name must be the
-- canonical name of a recognized language, or an error is thrown. Based on the language name, the `language_code` and
-- `language_object` properties are automatically filled in.
--
-- If the `regex` values of multiple category specs match, the first one takes precedence.
--
-- Recognized or predefined properties:
--
-- `pagename`: Current pagename.
-- `regex`: See above.
-- `1`, `2`, `3`, ...: See above.
-- `language_name`, `language_code`, `language_object`: See above.
-- `nolang`: See above.
-- `description`: Override the description (normally taken directly from the pagename).
-- `template_name`: Name of template which generates this category.
-- `template_sample_call`: Syntax for calling the template. Defaults to "{{{template_name}}}|{{{language_code}}}".
-- Used to display an example template call and the output of this call.
-- `template_actual_sample_call`: Syntax for calling the template. Takes precedence over `template_sample_call` when
-- generating example template output (but not when displaying an example template call) and is intended for a
-- template call that uses the |nocat=1 parameter.
-- `template_example_output`: Override the text that displays example template output (see `template_sample_call`).
-- `additional_template_description`: Extra text to be displayed after the example template output.
-- `parents`: Parent categories. Should be a list of elements, each of which is an object containing at least a name=
-- and sort= field (same format as parents= for regular raw categories, except that the name= and sort= field will
-- have {{{PROPERTY}}} references expanded). If no parents are specified, and the pagename is of the form
-- "Requests for FOO by language", the parent will be "Request subcategories by language" with FOO as the sort key.
-- Otherwise, the `language_name` property must exist, and the parent will be "Requests concerning LANGNAME" with
-- the pagename minus any initial "Requests for " as the sort key.
-- `umbrella`: Parent all-language category. Sort key is based on the language name.
-- `breadcrumb`: Specify the breadcrumb. If `parents` is given, there is no default (i.e. it will end up being the
-- pagename). Otherwise, if the pagename is of the form "Requests for FOO by language", "Requests for FOO in BAR",
-- or "Requests for FOO", it will be FOO.
-- `not_hidden_category`: Don't hide the category.
-- `catfix`: Same as `catfix` in regular labels and raw categories, except that request-specific {{{PROPERTY}}} syntax
-- is expanded.
-- `toc_template`, `toc_template_full`: Same as the corresponding fields in regular labels and raw categories, except
-- that request-specific {{{PROPERTY}}} syntax is expanded.
--
-- An actual template call can be inserted into a string using the syntax <<{{TEMPLATE|ARG1|ARG2|...}}>>.
local requests_categories = {
{
regex = "^(.+)相關請求$",
allow_etym_lang = true,
description = "需要有相關經驗的編者參與的{{{1}}}詞條。",
parents = {{name = "詞條維護", is_label = true, sort = "請求"}},
umbrella = "各語言請求",
breadcrumb = "請求",
not_hidden_category = true
},
{
regex = "^(.+)詞條詞源請求$",
allow_etym_lang = true,
umbrella = "各語言詞源請求",
template_name = "rfe",
},
{
regex = "^Requests for expansion of etymologies in (.+) entries$",
umbrella = "Requests for expansion of etymologies by language",
template_name = "etystub",
},
{
regex = "^(.+)詞條發音請求",
umbrella = "各語言發音請求",
template_name = "rfp",
},
{
regex = "^(.+)詞條發音音訊檔案請求$",
umbrella = "各語言發音音訊檔案請求",
template_name = "rfap",
},
{
regex = "^(.+)詞條定義請求",
umbrella = "各語言定義請求",
template_name = "rfdef",
},
{
regex = "^Requests for clarification of definitions in (.+) entries$",
umbrella = "Requests for clarification of definitions by language",
template_name = "rfclarify",
},
{
-- This is for part-of-speech-specific categories such as
-- "Requests for inflections in Northern Ndebele noun entries" or
-- "Requests for accents in Ukrainian proper noun entries".
-- Here and below, we assume that the part of speech is begins with
-- a lowercase letter, while the preceding language name ends in a
-- capitalized word. Note that this entry comes before the
-- following one and takes precedence over it.
regex = "^(.-)([名動形副專][容有]?[名]?詞)詞條屈折請求$",
parents = {{name = "{{{language_name}}}詞條屈折請求", sort = "{{{2}}}"}},
umbrella = "各語言{{{2}}}屈折請求",
breadcrumb = "{{{2}}}",
template_name = "rfinfl",
template_sample_call = "{{rfinfl|{{{language_code}}}|{{{2}}}}}",
},
{
regex = "^(.+)詞條屈折請求$",
umbrella = "各語言屈折請求",
template_name = "rfinfl",
},
{
regex = "^各語言(.+)屈折請求$",
nolang = true,
},
{
regex = "^Requests for tone in (.-) ([a-z]+[a-z ]*) entries$",
parents = {{name = "Requests for tone in {{{language_name}}} entries", sort = "{{{2}}}"}},
umbrella = "Requests for tone of {{{2}}}s by language",
breadcrumb = "{{{2}}}",
template_name = "rftone",
template_sample_call = "{{rftone|{{{language_code}}}|{{{2}}}}}",
},
{
regex = "^Requests for tone in (.+) entries$",
umbrella = "Requests for tone by language",
template_name = "rftone",
},
{
regex = "^Requests for tone of (.+) by language$",
nolang = true,
},
{
regex = "^Requests for accents in (.-) ([a-z]+[a-z ]*) entries$",
parents = {{name = "Requests for accents in {{{language_name}}} entries", sort = "{{{2}}}"}},
umbrella = "Requests for accents of {{{2}}}s by language",
breadcrumb = "{{{2}}}",
template_name = "rfaccents",
template_sample_call = "{{rfaccents|{{{language_code}}}|{{{2}}}}}",
},
{
regex = "^Requests for accents in (.+) entries$",
umbrella = "Requests for accents by language",
template_name = "rfaccents",
},
{
regex = "^Requests for accents of (.+) by language$",
nolang = true,
},
{
regex = "^Requests for aspect in (.-) ([a-z]+[a-z ]*) entries$",
parents = {{name = "Requests for aspect in {{{language_name}}} entries", sort = "{{{2}}}"}},
umbrella = "Requests for aspect of {{{2}}}s by language",
breadcrumb = "{{{2}}}",
template_name = "rfaspect",
template_sample_call = "{{rfaspect|{{{language_code}}}|{{{2}}}}}",
},
{
regex = "^Requests for aspect in (.+) entries$",
umbrella = "Requests for aspect by language",
template_name = "rfaspect",
},
{
regex = "^Requests for aspect of (.+) by language$",
nolang = true,
},
{
regex = "^Requests for gender in (.-) ([a-z]+[a-z ]*) entries$",
parents = {{name = "Requests for gender in {{{language_name}}} entries", sort = "{{{2}}}"}},
umbrella = "Requests for gender of {{{2}}}s by language",
breadcrumb = "{{{2}}}",
template_name = "rfgender",
template_sample_call = "{{rfgender|{{{language_code}}}|{{{2}}}}}",
},
{
regex = "^(.+)詞條性別請求",
umbrella = "各語言性別請求",
template_name = "rfgender",
},
{
regex = "^Requests for gender of (.+) by language$",
nolang = true,
},
{
regex = "^Requests for example sentences in (.+)$",
umbrella = "Requests for example sentences by language",
template_name = "rfex",
},
{
regex = "^Requests for quotations in (.+)$",
umbrella = "Requests for quotations by language",
template_name = "rfquote",
},
{
regex = "^Requests for translations into (.+)$",
umbrella = "Requests for translations by language",
template_name = "t-needed",
catfix = "en",
},
{
regex = "^([^各].+)使用例翻譯請求$",
umbrella = "各語言使用例翻譯請求",
breadcrumb = "使用例翻譯",
template_name = "t-needed",
template_sample_call = "{{t-needed|{{{language_code}}}|usex=1}}",
template_actual_sample_call = "{{t-needed|{{{language_code}}}|usex=1|nocat=1}}",
additional_template_description = "如果使用例是外語並且缺少翻譯,{{temp|ux}}、{{temp|uxi}}、{{temp|quote}}、{{temp|Q}}和{{temp|ja-usex}}模板會自動將頁面添加到此分類中。"
},
{
regex = "^([^各].+)引文翻譯請求$",
umbrella = "各語言引文翻譯請求",
breadcrumb = "引文翻譯",
template_name = "t-needed",
template_sample_call = "{{t-needed|{{{language_code}}}|quote=1}}",
template_actual_sample_call = "{{t-needed|{{{language_code}}}|quote=1|nocat=1}}",
additional_template_description = "如果使用例是外語並且缺少翻譯,{{temp|quote}}和{{temp|Q}}模板會自動將頁面添加到此分類中。"
},
{
regex = "^Requests for review of (.+) translations$",
umbrella = "Requests for review of translations by language",
breadcrumb = "Review of translations",
template_name = "t-check",
template_sample_call = "{{t-check|{{{language_code}}}|example}}",
template_example_output = "",
catfix = "en",
},
{
regex = "^(.+)詞轉寫請求",
umbrella = "各語言轉寫請求",
breadcrumb = "轉寫請求",
template_name = "rftranslit",
additional_template_description = "如果範例是沒有自動轉寫的語言(例如希伯來語和波斯語)," ..
"則 {{tl|head}} 模板及大量特定於該語言的標題行模板變體會自動將頁面加入至此分類。",
},
{
regex = "^(.+)詞原生文字請求$",
allow_etym_lang = true,
etym_parents = {
{name = "{{{parent_language_name}}}詞原生文字請求", sort = "{{{1}}}"},
{name = "{{{language_name}}}相關請求", sort = "native script"},
},
umbrella = "各語言原生文字請求",
template_name = "rfscript",
template_actual_sample_call = "{{rfscript|{{{language_code}}}|nocat=1}}",
catfix = false,
additional_template_description = "使用 {{tl|l}}、{{tl|m}} 和 {{tl|t}} 等模板時,若缺少條目本體但提供了轉寫,會自動將頁面放入此分類。"
},
{
regex = "^(.+)使用例原生文字請求$",
umbrella = "各語言使用例原生文字請求",
template_name = "rfscript",
template_sample_call = "{{rfscript|{{{language_code}}}|usex=1}}",
template_actual_sample_call = "{{rfscript|{{{language_code}}}|usex=1|nocat=1}}",
catfix = false,
additional_template_description = "使用 {{tl|ux}} 和 {{tl|uxi}} 模板時,如果例子本身缺失但提供了翻譯,會自動將頁面添加到此分類。"
},
{
regex = "^(.+)引文原生文字請求$",
umbrella = "各語言引文原生文字請求",
template_name = "rfscript",
template_sample_call = "{{rfscript|{{{language_code}}}|quote=1}}",
template_actual_sample_call = "{{rfscript|{{{language_code}}}|quote=1|nocat=1}}",
catfix = false,
additional_template_description = "使用{{tl|quote}} 和 {{code|<nowiki>{{quote-*}}</nowiki>}} 等模板時,如果引文本身缺失但提供了翻譯,會自動將頁面添加到此分類。"
},
{
regex = "^(.+)詞(.+[文名])請求$", -- 片假名?
language_name = "{{{1}}}",
allow_etym_lang = true,
parents = {{name = "{{{language_name}}}詞原生文字請求", sort = "{{{2}}}"}},
etym_parents = {
{name = "{{{language_name}}}詞原生文字請求", sort = "{{{2}}}"},
{name = "{{{parent_language_name}}}詞{{{2}}}請求", sort = "{{{language_name}}}"},
{name = "{{{language_name}}}相關請求", sort = "{{{2}}} script"},
},
umbrella = "各語言{{{2}}}請求",
breadcrumb = "{{{2}}}",
etym_breadcrumb = "{{{2}}}",
template_name = "rfscript",
-- NOTE: The following is used in `template_sample_call` and `template_actual_sample_call`, meaning the
-- conversion of script name to script code needs to be done using an inline function like this, instead of
-- a {{#invoke:...}} template call.
script_code = function(items)
return script_name_to_code(items["2"])
end,
template_sample_call = "{{rfscript|{{{language_code}}}|sc={{{script_code}}}}}",
template_actual_sample_call = "{{rfscript|{{{language_code}}}|sc={{{script_code}}}|nocat=1}}",
catfix = false,
additional_template_description = "使用 {{tl|l}}、{{tl|m}} 和 {{tl|t}} 等模板時,若缺少條目本體但提供了轉寫,會自動將頁面放入此分類。"
},
{
regex = "^各語言(.+[文名])請求$",
parents = {{name = "各語言文字請求", sort = "{{{1}}}"}},
breadcrumb = "{{{1}}}",
nolang = true,
},
{
regex = "^各語言文字請求$",
nolang = true,
},
{
regex = "^Requests for images in (.+) entries$",
umbrella = "Requests for images by language",
template_name = "rfi",
},
{
regex = "^Requests for references for (.+) terms$",
umbrella = "Requests for references by language",
template_name = "rfref",
},
{
regex = "^Requests for references for etymologies in (.+) entries$",
parents = {{name = "Requests for references for {{{language_name}}} terms", sort = "etymologies"}},
umbrella = "Requests for references for etymologies by language",
breadcrumb = "Etymologies",
template_name = "rfv-etym",
},
{
regex = "^Requests for references for pronunciations in (.+) entries$",
parents = {{name = "Requests for references for {{{language_name}}} terms", sort = "pronunciations"}},
umbrella = "Requests for references for pronunciations by language",
breadcrumb = "Pronunciations",
template_name = "rfv-pron",
},
{
regex = "^需要注意的(.+)詞$",
umbrella = "需要注意的詞",
template_name = "attention",
template_example_output = "This template does not generate any text in entries.",
-- These pages typically contain a mixture of English and native-language entries, so disable catfix.
catfix = false,
-- Setting catfix = false will normally trigger the English table of contents template.
-- We still want the native-language table of contents template, though.
toc_template = "{{{language_code}}}-categoryTOC",
toc_template_full = "{{{language_code}}}-categoryTOC/full",
},
{
regex = "^Requests for cleanup in (.+) entries$",
umbrella = "Requests for cleanup by language",
template_name = "rfc",
template_actual_sample_call = "{{rfc|{{{language_code}}}|nocat=1}}",
},
{
regex = "^Requests for cleanup of Pronunciation N headers in (.+) entries$",
umbrella = "Requests for cleanup of Pronunciation N headers by language",
template_name = "rfc-pron-n",
template_actual_sample_call = "{{rfc-pron-n|{{{language_code}}}|nocat=1}}",
template_example_output = "This template does not generate any text in entries.",
additional_template_description = [=[
The purpose of this category is to tag entries that use headers with "Pronunciation" and a number.
While these headers and structure are sometimes used, they are not specifically prescribed by [[WT:ELE]]. No complete proposal has yet been made on how they should work, what the semantics are, or how they interact with multiple etymologies. As a result they should generally be avoided. Instead, merge the entries (possibly under multiple Etymology sections, if appropriate), and list all pronunciations, appropriately tagged, under a Pronunciation header.
[[User:KassadBot|KassadBot]] tags these entries (or used to tag these entries, when the bot was operational). At some point if a proposal is made and adopted as policy, these entries should be reviewed.
This category is hidden.]=],
},
{
regex = "^Requests for deletion in (.+) entries$",
umbrella = "Requests for deletion by language",
template_name = "rfd",
template_actual_sample_call = "{{rfd|{{{language_code}}}|nocat=1}}",
},
{
regex = "^Requests for verification in (.+) entries$",
umbrella = "Requests for verification by language",
template_name = "rfv",
},
{
regex = "^Requests for attention in etymologies in (.+) entries$",
umbrella = "Requests for attention in etymologies by language",
},
{
regex = "^Requests for quotation/(.+)$",
description = "Requests for a quotation or for quotations from {{{1}}}.",
parents = {{name = "Requests for quotation by source", sort = "{{{1}}}"}},
breadcrumb = "{{{1}}}",
nolang = true,
template_name = "rfquotek",
template_sample_call = "{{rfquotek|LANGCODE|{{{1}}}}}",
template_example_output = "\n(where LANGCODE is the language code of the entry)\n\nIt results in the message below:\n\n{{rfquotek|und|{{{1}}}}}",
},
{
regex = "^Requests for date/(.+)$",
description = "Requests for a date for a quotation or quotations from {{{1}}}.",
parents = {{name = "Requests for date by source", sort = "{{{1}}}"}},
breadcrumb = "{{{1}}}",
nolang = true,
template_name = "rfdatek",
template_sample_call = "{{rfdatek|LANGCODE|{{{1}}}}}",
template_example_output = "\n(where LANGCODE is the language code of the entry)\n\nIt results in the message below:\n\n{{rfdatek|und|{{{1}}}}}",
},
}
table.insert(raw_handlers, function(data)
local items = {pagename = data.category}
local function replace_template_refs(result)
if not result then
return result
end
--[[ Replaces pseudo-template code {{{ }}} with the corresponding member
of the "items" table. Has to be done at least twice,
since some of the items are nested:
{{{template_sample_call_with_temp}}}
⇓
{{{{{template_name}}}|{{{language_code}}}}}
⇓
{{attention|en}} ]]
while result:find("{{{") do
result = mw.ustring.gsub(
result,
"{{{([^%}%{]+)}}}",
function(item)
if items[item] then
if type(items[item]) == "string" or type(items[item]) == "number" then
return items[item]
else
error('The item "{{{' .. item .. '}}}" is a ' .. type(items[item]) .. ' and can\'t be concatenated. (Pagename: ' .. items.pagename .. '.)')
end
else
error('The item "' .. item .. '" was not found in the "items" table. (Pagename: ' .. items.pagename .. '.)')
end
end
)
end
-- Preprocess template code surrounded by << >>, repeatedly from inside out
-- in case we have a << >> template call nested inside of another one
-- (this doesn't currently happen). We need this mechanism at all because
-- in "Requests for SCRIPT script for LANGUAGE terms", we need to convert the
-- script to a script code before insertion into the template example code,
-- which is inside of <pre> so it won't get expanded by the normal poscatboiler
-- mechanism.
while result:find("<<") do
result = mw.ustring.gsub(
result,
"<<([^><]+)>>",
function (template_code)
return mw.getCurrentFrame():preprocess(template_code)
end
)
end
return result
end
local valid_category = false
for i, category in ipairs(requests_categories) do
local matchvals = {mw.ustring.match(items.pagename, category.regex)}
if #matchvals > 0 then
valid_category = true
for key, value in pairs(category) do
items[key] = value
end
for key, value in ipairs(matchvals) do
items["" .. key] = value
end
break
end
end
if not valid_category then
for i, category in ipairs(requests_categories) do
if items.pagename == category.umbrella then
valid_category = true
items.nolang = true
end
end
end
if not valid_category then
return nil
end
if not items.nolang then
items.language_name = items.language_name or "{{{1}}}"
items.language_name = replace_template_refs(items.language_name)
if items.etym_lang_only then
items.language_object = require("Module:etymology languages").getByCanonicalName(items.language_name)
if not items.language_object then
return nil
end
items.language_code = items.language_object:getCode()
items.parent_language_object = items.language_object:getFull()
-- Reject weird cases where etymology language has no parent.
if not items.parent_language_object then
return nil
end
items.parent_language_code = items.parent_language_object:getCode()
items.parent_language_name = items.parent_language_object:getCanonicalName()
-- Reject weird cases where the parent language has the same name as the child etymology language. In that case,
-- we'll get an infinite parent-category loop. This actually happens, e.g. with Rudbari and Bashkardi.
if items.parent_language_name == items.language_name then
return nil
end
else
mw.logObject(items)
items.language_object = require("Module:languages").getByCanonicalName(items.language_name, true,
items.allow_etym_lang)
items.language_code = items.language_object:getCode()
items.is_etym_lang = items.language_object:hasType("etymology-only")
if items.is_etym_lang then
items.parent_language_object = items.language_object:getFull()
-- Reject weird cases where etymology language has no parent.
if not items.parent_language_object then
return nil
end
items.parent_language_code = items.parent_language_object:getCode()
items.parent_language_name = items.parent_language_object:getCanonicalName()
-- Reject weird cases where the parent language has the same name as the child etymology language. In
-- that case, we'll get an infinite parent-category loop. This actually happens, e.g. with Rudbari and
-- Bashkardi.
if items.parent_language_name == items.language_name then
return nil
end
end
end
end
if items.template_name then
items.template_sample_call = items.template_sample_call or "{{{{{template_name}}}|{{{language_code}}}}}"
items.full_text_about_the_template = "要提出這個語言的這項請求,請在條目中使用這段代碼(另見[[Template:{{{template_name}}}]]的文檔):\n\n<pre>{{{template_sample_call}}}</pre>"
if items.template_example_output then
items.full_text_about_the_template = items.full_text_about_the_template .. " " .. items.template_example_output
else
items.template_actual_sample_call = items.template_actual_sample_call or items.template_sample_call
items.full_text_about_the_template = items.full_text_about_the_template .. "\n會產生下面這條消息:\n\n{{{template_actual_sample_call}}}"
end
if items.additional_template_description then
items.full_text_about_the_template = items.full_text_about_the_template .. "\n\n" .. items.additional_template_description
end
end
local parents = items.parents
local breadcrumb = items.breadcrumb and replace_template_refs(items.breadcrumb)
if parents then
for _, parent in ipairs(parents) do
parent.name = replace_template_refs(parent.name)
parent.sort = replace_template_refs(parent.sort)
end
else
local umbrella_type = items.pagename:match("^各語言(.+)請求$") or items.pagename:match("^需要(.+)的詞$")
if umbrella_type then
breadcrumb = breadcrumb or umbrella_type
parents = {{name = "請求子分類", sort = umbrella_type}}
elseif not items.language_name then
error("Internal error: Don't know how to compute parents for non-language-specific category '" .. items.pagename .. "'")
else
local default_breadcrumb = items.pagename:match("^Requests for (.+) in .*$") or items.pagename:match("^Requests for (.+)$")
breadcrumb = breadcrumb or default_breadcrumb
parents = {{name = items.language_name .. "相關請求", sort = default_breadcrumb}}
end
end
if not items.nolang then
table.insert(parents, {name = replace_template_refs(items.umbrella), sort = items.language_name})
end
local additional = replace_template_refs(items.full_text_about_the_template)
if items.pagename:find("^各語言") then
additional = "{{{umbrella_msg}}}" .. (additional and "\n\n" .. additional or "")
end
return {
description = replace_template_refs(items.description) or items.pagename .. "。",
lang = items.parent_language_code or items.language_code,
additional = additional,
parents = parents,
-- If no breadcrumb=, it will default to the category name
breadcrumb = breadcrumb,
catfix = replace_template_refs(items.catfix),
toc_template = replace_template_refs(items.toc_template),
toc_template_full = replace_template_refs(items.toc_template_full),
hidden = not items.not_hidden_category,
can_be_empty = true,
}
end)
return {LABELS = labels, RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers}