ماڈیوٗل:روٗپ
Appearance
"یَمہٕ ماڈیوٗلُک دَستاویز ییٚہِ ماڈیوٗل:روٗپ/دَستاویز جاے بَناونہٕ"
local p = {}
local names = require("Module:lang name")
local cases = {['nom'] = 'آسَن',
['erg'] = 'کرٛاوَل',
['dat'] = 'دُکرٛٲوؠ',
['abl'] = 'آیِتؠ',
['acc'] = 'کرٛٲوؠ',
['ins'] = 'کرٛاوَل',
['gen'] = 'مِلکِیَتی',
['loc'] = 'ہاوَن',
}
function p.split(s, delimiter)
result = {}
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
local nums = {['sg'] = 'وٲحِد',
['du'] = 'دۆگُن',
['pl'] = 'جَمَع',
}
function p.table_len(tab)
length = 0
for _ in pairs(tab) do
length = length + 1
end
return length
end
function p.add(params)
local case_given_raw = params.args["form"]
local lemma = params.args["lemma"]
local lang_code = params.args["lang"]
local out = ""
local pos = params.args["pos"]
if pos == "noun" then
p.cat_name = " ناوٕتؠ"
elseif pos == "pronoun" then
p.cat_name = " اِشارٕ ناوٕتؠ"
end
if not string.match(case_given_raw, ";") then
local given_lst = p.split(case_given_raw, "-")
local case_given = p.split(given_lst[1], "//")
local num_given = p.split(given_lst[2], "//")
out = out .. "<strong>[[" .. lemma .. "]]</strong> لَفظہٕ سُنٛد "
if p.table_len(case_given) ~= 0 then
for n, case in ipairs(case_given) do
if n == 1 then
out = out .. cases[case]
if case ~= 'nom' then out = out .. "[[زٲژ:" .. cases[case] .. " حالَتَس مَنٛز " .. names.plural_lang(lang_code) .. p.cat_name.. " ]]" end
else
out = out .. "/" .. cases[case]
if case ~= 'nom' then
out = out .. "[[زٲژ:" .. cases[case] .. " حالَتَس مَنٛز " .. names.plural_lang(lang_code) .. p.cat_name.. " ]]"
end
end
end
out = out .. " حالَتھ "
end
if p.table_len(num_given) ~= 0 then
for n, num in ipairs(num_given) do
if n == 1 then
out = out .. nums[num]
else
out = out .. "/" .. cases[case] .. "[[زٲژ:" .. cases[case] .. " حالَتَس مَنٛز " .. names.plural_lang(lang_code).. p.cat_name.. " ]]"
end
end
end
out = out .. " رٟپ"
else
local diff_cases = p.split(case_given_raw, ";")
out = out .. "<strong>[[" .. lemma .. "]]</strong> لَفظہٕ سُنٛد رٟپ: "
for n, case_given in ipairs(diff_cases) do
local given_lst = p.split(case_given, "-")
local case_given = p.split(given_lst[1], "//")
local num_given = p.split(given_lst[2], "//")
out = out .. "\n#:#"
if p.table_len(case_given) ~= 0 then
for n, case in ipairs(case_given) do
if n == 1 then
out = out .. cases[case] .. "[[زٲژ:" .. cases[case] .. " حالَتَس مَنٛز " .. names.plural_lang(lang_code) .. p.cat_name.. " ]]"
else
out = out .. "/" .. cases[case] .. "[[زٲژ:" .. cases[case] .. " حالَتَس مَنٛز " .. names.plural_lang(lang_code) .. p.cat_name.. " ]]"
end
end
out = out .. " حالَتھ "
end
if p.table_len(num_given) ~= 0 then
for n, num in ipairs(num_given) do
if n == 1 then
out = out .. nums[num]
else
out = out .. "/" .. nums[num]
end
end
end
end
end
return out
end
return p