Bu modul uchun Modul:ta-headword/doc nomli hujjat sahifasini yaratishingiz mumkin

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("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")

	local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {args["head"]}, 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, "Tamil terms spelled with " .. letter)
	end

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

end

pos_functions["nouns"] = function(args, data)

	local plurals = {label = "plural"}

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

end

pos_functions["pronouns"] = function(args, data)

	local plurals = {label = "plural"}

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

end

return export