Module:Accent qualifier
Appearance
local export = {}
local m_qualifier = require("Module:qualifier")
function export.format_qualifiers(qualifiers)
local data = mw.loadData("Module:accent qualifier/data")
if type(qualifiers) ~= "table" then
qualifiers = { qualifiers }
end
local accents = {}
for _, accent in ipairs(qualifiers) do
if data[accent] then
if data[accent].link then
table.insert(accents, "[[w:" .. data[accent].link .. "|" ..
(data[accent].display or data[accent].link) .. "]]")
elseif data[accent].display then
table.insert(accents, data[accent].display)
end
else
table.insert(accents, accent)
end
end
return m_qualifier.format_qualifier(accents)
end
-- Called by {{accent}} or {{a}}.
function export.show(frame)
local args = frame.getParent and frame:getParent().args or frame
if (not args[1] or args[1] == "") and mw.title.getCurrentTitle().nsText == "Template" then
return m_qualifier.format_qualifier{ '{{{1}}}' }
end
local params = {
[1] = {required = true, list = true}
}
args = require("Module:parameters").process(args, params)
return export.format_qualifiers(args[1])
end
return export