پودمان:maintenance category
توضیحات این پودمان میتواند در پودمان:maintenance category/توضیحات قرار گیرد.
local format_categories = require("Module:utilities").format_categories
local match = string.match
local process_params = require("Module:parameters").process
local title
local export = {}
local function ret(name, cat)
return cat and format_categories({name}, nil, "-", nil, true) or name
end
function export.get_category(name, cat)
title = title or mw.title.getCurrentTitle()
-- All talkpages.
if title.isTalkPage then
return ret(name .. "/hidden", cat)
end
local namespace = title.namespace
-- User:, Thread:, and Summary:
if namespace == 2 or namespace == 90 or namespace == 92 then
return ret(name .. "/hidden", cat)
-- Template: and Module:.
elseif not (namespace == 10 or namespace == 828) then
return ret(name, cat)
end
local title_text = title.text
if (
-- Template:User: and Module:User:.
match(title_text, "^User:") or
-- Any template/module sandboxes (which can be numbered and/or followed by further subpages), including any templates/modules with the name sandbox.
match(title_text, "%f[^%z/][sS][aA][nN][dD][bB][oO][xX] ?%d*%f[%z/]") or
-- Any template/module testcases (which can be numbered and/or followed by further subpages).
match(title_text, "/[tT][eE][sS][tT][cC][aA][sS][eE][sS]? ?%d*%f[%z/]")
) then
return ret(name .. "/hidden", cat)
end
return ret(name, cat)
end
function export.template(frame)
local args = process_params(frame:getParent().args, {
[1] = {required = true, default = ""},
["cat"] = {type = "boolean", default = false}
})
return export.get_category(args[1], args.cat)
end
return export