Modül:aksan belirtici

Modül belgelemesi [Oluştur]


local cikart = {}
local m_qualifier = require("Modül:belirtici")

function cikart.bicimlendir_belirticiler(qualifiers)
	local m_data = mw.loadData("Modül:aksan belirtici/veri")
	
	if type(qualifiers) ~= "table" then
		qualifiers = { qualifiers }
	end
	
	local accents = {}
	local categories = {}
	
	for _, accent in ipairs(qualifiers) do
		local data
		
		-- Replace an alias with the label that has a data table.
		if m_data.digerler[accent] then
			accent = m_data.digerler[accent]
		end
		
		-- Retrieve the label's data table.
		if m_data.etiketler[accent] then
			data = m_data.etiketler[accent]
		end
		
		-- Use the link and displayed text in the data table, if they exist.
		if data then
			if data.bag then
				table.insert(accents, "[[w:" .. data.bag .. "|" ..
					(data.goster or data.bag) .. "]]")
			elseif data.goster then
				table.insert(accents, data.goster)
			end
			
			--[[
			if data[accent] then
				if data[accent].type == "sound change" then
					table.insert(categories, lang:getCanonicalName() .. " terms with pronunciations exhibiting " .. accent)
				end
			end
			]]
		else
			table.insert(accents, accent)
		end
	end
	
	return m_qualifier.bicimlendir_belirtici(accents)
end

-- Called by {{accent}} or {{a}}.
function cikart.goster(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.bicimlendir_belirtici{ '{{{1}}}' }
	end
	
	local params = {
		[1] = {required = true, list = true}
	}
	args = require("Modül:parameters").process(args, params)
	
	return cikart.bicimlendir_belirticiler(args[1])
end

return cikart