ماڈیوٗل:ks-decl-noun-m

وِکیٖلۄغَتھ پؠٹھٕ

"یَمہٕ ماڈیوٗلُک دَستاویز ییٚہِ ماڈیوٗل:ks-decl-noun-m/دَستاویز جاے بَناونہٕ"

local p = {}
function p.trim(s)
	if s ~= nil then
		return (s:gsub("^%s*(.-)%s*$", "%1"))
	else
		return s
	end
end
--[=====[
function p.l(l)
	return '<span style="font-size:90%; color:#888">[[' .. l .. '#کٲشُر|' ..  l .. ']]</span>'
end
--]=====]
function p.add_table(params)
	local script = p.trim(params.args['script'])
	local word = p.trim(params.args.word)
	local nom_s = p.trim(params.args.nom_s)
	local nom_pl = p.trim(params.args.nom_pl)
	local erg_s = p.trim(params.args.erg_s)
	local erg_pl = p.trim(params.args.erg_pl)
	local abl_s = p.trim(params.args.abl_s)
	local abl_pl = p.trim(params.args.abl_pl)
	local dat_s = p.trim(params.args.dat_s)
	local dat_pl = p.trim(params.args.dat_pl)
	local o_s = params.args['only_sg']
	local o_p = params.args['only_pl']
	if word == "" then word = tostring(mw.title.getCurrentTitle()) end
	local out = [[<div class="mw-collapsible mw-collapsed" style="padding: 4px; border: 1px solid #a2a9b1; text-align: center; font-size: 95%;width:30%;">
<div style="line-height: 1.6em; font-weight: bold; background-color: #ccf;"><div style="margin: 0 4em">
]]
	if script == "Deva" then
		forms = require("Module:ks-deva-decl-noun-m")
	else
		forms = require("Module:ks-arab-decl-noun-m")
	end
	out = out .. word .. " " .. "ہٕنٛدؠ رٟپؠ (موٗل: " .. forms.get_stem(word) .. ")"
	out = out .. '</div></div><div class="mw-collapsible-content" style="font-size: 100%;">\n'
	out = out .. '{| style="background: #ffffff; text-align: center; width:{{{width|30}}}em; border-spacing:0px;" class="inflection-table"'
	out = out .. '\n! style="background: #e8f2fe; padding: 4px" | حالَتھ\n! style="background: #e8f2fe; width: 50%" |وٲحِد\n! style="background: #e8f2fe; width: 50%" |جَمَع'
	local cases = {'آسَن', 'کرٛاوَل', 'دُکرٛٲوؠ', 'آیِتؠ'}
	local s_terms = {nom_s, erg_s, dat_s, abl_s}
	local s_fs = {forms.nom_s(word), forms.erg_s(word), forms.dat_s(word), forms.abl_s(word) ,}
	local p_terms = {nom_pl, erg_pl, dat_pl, abl_pl}
	local p_fs = {forms.nom_pl(word), forms.erg_pl(word), forms.dat_pl(word), forms.abl_pl(word)}
	for n, case in ipairs(cases) do
		local s = s_terms[n]
		local pl = p_terms[n]
		out = out .. '\n|-\n! style="background: #e8f2fe; text-align: left; padding: 4px"|[[' .. case .. 'حالَتھ|' .. case .. ']]\n'
		if o_p == 'true' or o_p == '1' then
			out = out .. "\n|—"
		else
			if s ~= "" and s ~= nil then
				out = out .. '\n|[[' ..  s .. ']]'
			else
				out = out .. '\n|[[' .. s_fs[n] .. ']]'
			end
		end
		if o_s == 'true' or o_s == '1' then
			out = out .. "\n|—\n|-"
		else
			if pl ~= "" and pl ~= nil then
				out = out .. '\n|[[' ..  pl .. ']]\n|-'
			else
				out = out .. '\n|[[' .. p_fs[n] .. ']]\n|-'
			end
		end
	end

	out = out .. '\n|}'
	out = out .. '</div>\n</div></div>'
	return out
end
return p