Pergi ke kandungan

Modul:ta-headword

Daripada Wikikamus
local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("ta")
local script = require("Module:scripts").getByCode("Taml")
local PAGENAME = mw.title.getCurrentTitle().text

function export.show(frame)

	local args = frame:getParent().args
	local poscat = frame.args[1] or error("Golongan kata belum ditentukan. Tolong lepasi parameter 1 ke penyeruan modul.")

	local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {args["head"] or PAGENAME}, inflections = {}}

	if pos_functions[poscat] then
		pos_functions[poscat](args, data)
	end

	local letter = true
	local specialLetter = mw.ustring.gmatch(PAGENAME, '.-([ஃஜஶஷஸஹ]).-')
	while true do
		letter = specialLetter()
		if (not letter) then break end
		table.insert(data.categories, "Kata bahasa Tamil yang dieja dengan " .. letter)
	end

	return require("Module:headword").full_headword(data)

end

pos_functions["kata nama"] = function(args, data)

	local plurals = {label = "jamak"}

	if args["pl"] then
		table.insert(plurals, args["pl"])
		table.insert(data.inflections, plurals)
	end

end

pos_functions["kata ganti"] = function(args, data)

	local plurals = {label = "jamak"}

	if args["pl"] then
		table.insert(plurals, args["pl"])
		table.insert(data.inflections, plurals)
	end

end

return export