This module implements the template {{attention}}
.
local export = {}
local format_categories = require("Module:utilities").format_categories
local html_create = mw.html.create
local insert = table.insert
local process_params = require("Module:parameters").process
function export.show(frame)
local args = process_params(frame:getParent().args, {
= {required = true, type = "language"},
= true,
= true,
= true,
})
local lang = args
local lang_code = lang:getCode()
local title = args
local id = args or ""
local categories = {"Requests for attention concerning " .. lang:getCanonicalName()}
if not title then
insert(categories, {cat = "attention lacking explanation", sort_key = "-"})
end
-- mw.html escapes special characters in the id and title attributes.
local ret = html_create("span")
:addClass("attentionseeking")
:attr("lang", lang_code)
if id ~= "" then
ret = ret:attr("id", "attentionseeking" .. lang_code .. id)
end
if title then
ret = ret:attr("title", title)
end
return tostring(ret) .. format_categories(categories, lang, args.sort)
end
return export