Module:category tree: Difference between revisions

allow etym langs as specified lang for categories like Category:Hazaragi reference templates
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 64: Line 64:
"red",
"red",
"[[File:Codex icon Alert red.svg|40px|alt=alert]]",
"[[File:Codex icon Alert red.svg|40px|alt=alert]]",
"This category is not defined in Wiktionary's category tree.",
"This category is not defined in Contionary's category tree.",
text
text
)
)
Line 105: Line 105:
-- Proto-Norse (gmq-pro) is probably the only language with a code ending in -pro
-- Proto-Norse (gmq-pro) is probably the only language with a code ending in -pro
-- that's intended to have mostly non-reconstructed entries.
-- that's intended to have mostly non-reconstructed entries.
if (lang_code:find("%-pro$") and lang_code ~= "gmq-pro") or lang:hasType("reconstructed") then
if (lang_code:find("%-pro$") and lang_code ~= "gmq-pro") or (lang:hasType("reconstructed") and not lang:hasType("conlang")) then
namespace = namespace .. "Reconstruction"
namespace = namespace .. "Reconstruction"
elseif lang:hasType("appendix-constructed") then
elseif lang:hasType("appendix-constructed") then
Line 417: Line 417:


local function generate_output(current)
local function generate_output(current)
if current then
for _, functionName in pairs{
"getBreadcrumbName",
"getDataModule",
"canBeEmpty",
"getDescription",
"getParents",
"getChildren",
"getUmbrella",
"getAppendix",
"getTOCTemplateName",
} do
if not is_callable(current[functionName]) then
require("Module:debug").track{"category tree/missing function", "category tree/missing function/" .. functionName}
end
end
end


local boxes, display, categories = {}, {}, {}
local boxes, display, categories = {}, {}, {}
Line 460: Line 443:
"Double-check the category name for typos. <br>" ..
"Double-check the category name for typos. <br>" ..
"[[Special:Search/Category: " .. current_title.text:gsub("^.+:", ""):gsub(" ", "~2 ") .. '~2|Search existing categories]] to check if this category should be created under a different name (for example, "Fruits" instead of "Fruit"). <br>' ..
"[[Special:Search/Category: " .. current_title.text:gsub("^.+:", ""):gsub(" ", "~2 ") .. '~2|Search existing categories]] to check if this category should be created under a different name (for example, "Fruits" instead of "Fruit"). <br>' ..
"To request the definition of a new category in Wiktionary's category tree, please start a new topic at [[Wiktionary:Category and label treatment requests]]."))
"To request the definition of a new category in Contionary's category tree, please contact the [[Linguifex:Administrator|admins]]."))
-- Exit here, as all code beyond here relies on current not being nil
-- Exit here, as all code beyond here relies on current not being nil
Line 616: Line 599:
if submodule then
if submodule then
info.also = deep_copy(args.also)
info.also = deep_copy(args.also)
require("Module:debug").track("auto cat/" .. submodule)
-- `failed` is true if no match was found.
-- `failed` is true if no match was found.
submodule = require(category_tree_submodule_prefix .. submodule)
submodule = require(category_tree_submodule_prefix .. submodule)