Modul:es-headword
Qiyofa
Bu modul uchun Modul:es-headword/doc nomli hujjat sahifasini yaratishingiz mumkin
local export = {}
local pos_functions = {}
local tili = require("Module:tili").getByCode("es")
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
PAGENAME = mw.title.getCurrentTitle().text
local poscat = frame.args[1] or error("Nutq qismi belgilangan olinmagan. Moduli nolish uchun parametrni 1 o'tishi qiling.")
local params = {
["bosh"] = {list = true, default = ""},
["suff"] = {type = "boolean"},
}
if pos_functions[poscat] then
for key, val in pairs(pos_functions[poscat].params) do
params[key] = val
end
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {heads = args["head"], genders = {}, inflections = {}, categories = {}}
if args["suff"] then
table.insert(data.categories, tili:getCanonicalName() .. " suffixes")
if poscat == "sifat" then
table.insert(data.categories, tili:getCanonicalName() .. " sifat-hosil qoʻshimchalar")
elseif poscat == "holi" then
table.insert(data.categories, tili:getCanonicalName() .. " holi-hosil qoʻshimchalar")
elseif poscat == "ismari" then
table.insert(data.categories, tili:getCanonicalName() .. " ot-hosil qoʻshimchalar")
elseif poscat == "feʼli" then
table.insert(data.categories, tili:getCanonicalName() .. " feʼli-hosil qoʻshimchalar")
else
error("Takliflar turkumda shakllantirish yasovchi qoʻshimchalar uchun mavjud " .. poscat .. ".")
end
else
table.insert(data.categories, tili:getCanonicalName() .. " " .. poscat)
end
if pos_functions[poscat] then
pos_functions[poscat].func(args, data)
end
return require("Module:headword").full_headword(tili, nil, data.heads, nil, data.genders, data.inflections, data.categories, nil)
end
-- Display information for a noun's gender
-- This is separate so that it can also be used for proper nouns
function noun_gender(args, data)
local categories = {}
local gender = args[1]
if gender == "m-p" or gender == "f-p" then
table.insert(data.categories, "Spanish pluralia tantum")
end
if gender == "mf" then
table.insert(data.genders, "m")
table.insert(data.genders, "f")
else
table.insert(data.genders, gender)
end
if #data.genders == 0 then
table.insert(data.genders, "?")
end
end
pos_functions["atoqli ot"] = {
params = {
[1] = {},
},
func = function(args, data)
noun_gender(args, genders, inflections, categories)
end
}
-- Display additional inflection information for a noun
pos_functions["ot"] = {
params = {
[1] = {},
[2] = {},
["pl2"] = {},
["f"] = {},
["fpl"] = {},
["m"] = {},
["mpl"] = {},
},
func = function(args, data)
noun_gender(args, data)
-- Koʻplik
if data.genders[1] == "m-p" or data.genders[1] == "f-p" then
table.insert(data.inflections, {label = "[[Appendix:Glossariy#plurale tantum|plurale tantum]]"})
else
local plural = args[2]
if plural == "-" then
table.insert(data.inflections, {label = "[[Appendix:Glossariy#sonsiz|sonsiz]]"})
table.insert(data.categories, "Ispancha ko'p maʼnoga ega boʻlgan moddalar")
else
local infl_parts = {label = "koʻplik", accel = "plural-form-of"}
local plural2 = args["pl2"]
if not plural or plural == "s" then
plural = PAGENAME .. "s"
elseif plural == "es" then
plural = PAGENAME .. "es"
end
table.insert(infl_parts, plural)
if plural2 then
table.insert(infl_parts, plural2)
end
if plural and not mw.title.new(plural).exists then
table.insert(data.categories, "Etishmayotgan koʻplik bilan ispan maʼnoga ega boʻlgan moddalar")
end
if plural2 and not mw.title.new(plural2).exists then
table.insert(data.categories, "Etishmayotgan koʻplik bilan ispan maʼnoga ega boʻlgan moddalar")
end
table.insert(data.inflections, infl_parts)
end
end
-- Gendered forms
local feminine = args["f"]
local feminine_pl = args["fpl"]
local masculine = args["m"]
local masculine_pl = args["mpl"]
if feminine then
table.insert(data.inflections, {label = "ayol", feminine})
if not mw.title.new(feminine).exists then
table.insert(data.categories, "Ispancha ot shakllar toʻliqsiz")
end
end
if feminine_pl then
table.insert(data.inflections, {label = "ayolsiz koʻplik", feminine_pl})
if not mw.title.new(feminine_pl).exists then
table.insert(data.categories, "Ispancha ot shakllar toʻliqsiz")
end
end
if masculine then
table.insert(data.inflections, {label = "erkak", masculine})
if not mw.title.new(masculine).exists then
table.insert(data.categories, "Ispancha ot shakllar toʻliqsiz")
end
end
if masculine_pl then
table.insert(data.inflections, {label = "erkaksiz koʻplik", masculine_pl})
if not mw.title.new(masculine_pl).exists then
table.insert(data.categories, "Ispancha ot shakllar toʻliqsiz")
end
end
end
}
function make_plural(base, gender)
return base .. "s"
end
return export