Modul:yej-headword
Qiyofa
Bu modul uchun Modul:yej-headword/doc nomli hujjat sahifasini yaratishingiz mumkin
local export = {}
local lang = require("Module:languages").getByCode("yej")
local function get_params_list(args, argprefix)
local export = {}
i = 1
term = argprefix
while args[term] ~= nil and args[term] ~= "" do
table.insert(export, term)
i = i + 1
term = argprefix .. i
end
return export
end
local function get_params_list(args, argprefix)
local export = {}
i = 1
term = argprefix
while args[term] ~= nil and args[term] ~= "" do
table.insert(export, term)
i = i + 1
term = argprefix .. i
end
return export
end
local function otherscript(inflections, args)
local sc = lang:findBestScript(mw.title.getCurrentTitle().subpageText)
local other_sc
if sc:getCode() == "Grek" then
other_sc = "Hebr"
elseif sc:getCode() == "Hebr" then
other_sc = "Grek"
end
other_sc = require("Module:scripts").getByCode(other_sc)
local inflection = {label = other_sc:getCanonicalName() .. " spelling"}
for i, head in ipairs(args["head"]) do
if head == "" then
head = mw.title.getCurrentTitle().subpageText
end
table.insert(inflection, {term = tr, sc = other_sc})
end
table.insert(inflections, inflection)
end
function export.basic(frame)
local params = {
["head"] = {list = true, default = ""},
["tr"] = {list = true, allow_holes = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = frame.args[1], categories = {}, heads = args["head"], genders = {}, inflections = {}}
otherscript(data.inflections, args)
return require("Module:headword").full_headword(data)
end
function export.adjective(frame)
local params = {
["comp"] = {},
["def"] = {},
["head"] = {list = true, default = ""},
["tr"] = {list = true, allow_holes = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "adjectives", categories = {}, heads = args["head"], genders = {}, inflections = {}}
if args["def"] then
table.insert(data.inflections, {label = "definite", args["def"]})
end
if args["comp"] then
table.insert(data.inflections, {label = "comparative", args["comp"]})
end
otherscript(data.inflections, args)
return require("Module:headword").full_headword(data)
end
local gender_cats = {
["m"] = "masculine",
["f"] = "feminine",
["n"] = "neuter",
["m-p"] = "masculine",
["f-p"] = "feminine",
["n-p"] = "neuter",
}
function export.noun(frame)
local params = {
["g"] = {list = true, default = "?"},
["head"] = {list = true, default = ""},
["tr"] = {list = true, allow_holes = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "nouns", categories = {}, heads = args["head"], genders = args["g"], inflections = {}}
for i, gender in ipairs(data.genders) do
if gender_cats[gender] then
table.insert(data.categories, lang:getCanonicalName() .. " " .. gender_cats[gender] .. " nouns")
else
data.genders[i] = "?"
end
end
otherscript(data.inflections, args)
return require("Module:headword").full_headword(data)
end
--[[
local data = {lang = lang, pos_category = poscat, categories = {}, heads = make_params_array(args, get_params_list(args, "head")), translits = make_params_array(args, get_params_list(args, "tr")), genders = {}, inflections = {}}
local head = args["head"]; if head == "" then head = nil end; data.heads[1] = head
--]]
function export.propernoun(frame)
local params = {
["g"] = {list = true, default = "?"},
["head"] = {list = true, default = ""},
["tr"] = {list = true, allow_holes = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "proper nouns", categories = {}, heads = args["head"], genders = args["g"], inflections = {}}
for i, gender in ipairs(data.genders) do
if gender_cats[gender] then
table.insert(data.categories, lang:getCanonicalName() .. " " .. gender_cats[gender] .. " nouns")
else
data.genders[i] = "?"
end
end
otherscript(data.inflections, args)
return require("Module:headword").full_headword(data)
end
function export.verb(frame)
local params = {
["a"] = {},
["head"] = {list = true, default = ""},
["tr"] = {list = true, allow_holes = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = "verbs", categories = {}, heads = args["head"], genders = {}, inflections = {}}
if args["a"] == "impf" or args["a"] == "pf" then
table.insert(data.genders, args["a"])
elseif args["a"] == "impf-pf" or args["a"] == "pf-impf" or args["a"] == "dual" or args["a"] == "ip" then
table.insert(data.genders, "impf")
table.insert(data.genders, "pf")
else
table.insert(data.genders, "?")
end
otherscript(data.inflections, args)
return require("Module:headword").full_headword(data)
end
return export