This module implements the {{a}} template. To add more regional accent presets, edit Module:accent qualifier/data.


local export = {}
local m_qualifier = require("Module:qualifier")

function export.show(frame)
	data = mw.loadData("Module:accent qualifier/data")
	
	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}
	}
	local inputs = require("Module:parameters").process(args, params)
	
	local accents = {}
	
	for _, accent in ipairs(inputs[1]) 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

return export