Модул:attention
Документацију овог модула можете да направите на страници Модул:attention/док
local format_categories = require("Module:utilities").format_categories
local html_create = mw.html.create
local process_params = require("Module:parameters").process
local export = {}
local function get_args(frame)
local plain = {}
return process_params(frame:getParent().args, {
[1] = {required = true},
[2] = plain,
["id"] = plain,
["nocat"] = {type = "boolean"},
["sort"] = plain,
})
end
function export.show(frame)
local args = get_args(frame)
local lang_code = args[1]
local title = args[2]
local id = args["id"] or ""
local categories = {}
if not args["nocat"] then
local lang = require("Module:languages").getByCode(lang_code, 1)
table.insert(categories, format_categories({"Requests for attention concerning " .. lang:getCanonicalName()}, lang))
if not (title or mw.title.getCurrentTitle().nsText == "Template") then
table.insert(categories, format_categories({"attention lacking explanation"}, lang, "-"))
end
end
-- mw.html escapes special characters in the id and title attributes.
local ret = html_create("span")
:attr("id", "attentionseeking" .. lang_code .. id)
:addClass("attentionseeking")
:attr("lang", lang_code)
if title then
ret = ret:attr("title", title)
end
return tostring(ret) .. table.concat(categories)
end
return export