Modul:rêziman
Xuyakirin

- Ev belge ji Modul:rêziman/belge hatiye girtin.
Bikaranîn
[biguhêre]Di nav şablonên da tê bikaranîn
{{#invoke:rêziman|cure|nav=}}
{{#invoke:rêziman|cure|nav=|kat=}}
Hemû parametreyan:
{{#invoke:rêziman|cure|nav=|navcure=|kat=|link=}}
Bo şablonan, bnr.
Çewtiyên koda zimanî:
Mijarên têkildar:
Şablon![]() |
{{navdêr}} · {{serenav}} · {{lêker}} · {{rengdêr}} · {{hoker}} · {{cînav}} · {{girêdek}} · {{daçek}} · {{pêşdaçek}} · {{paşdaçek}} · {{bazinedaçek}} · {{artîkel}} · {{pirtik}} · {{baneşan}} · {{navgir}} · {{paşgir}} · {{pêşgir}} · {{reh}} · {{biwêj}} · {{hevok}} · {{gp}} (gotineke pêşiyan) · {{hejmar}} · {{tîp}} · {{sembol}} · {{kurtenav}} |
---|---|
Têkildar |
|
insert = table.insert
local process_params = require("Module:parameters").process
local export = {}
local function ferhengok(entry, text)
text = text or entry
return "[[Nimînok:Ferhengok#" .. entry .. "|" .. text .. "]]"
end
local function get_args(frame)
local boolean = {type = "boolean"}
local boolean_list_allow_holes = {type = "boolean", list = true, allow_holes = true}
local list_allow_holes = {list = true, allow_holes = true}
return process_params(frame:getParent().args, {
[1] = {required = true, type = "language", default = "und"},
["sc"] = {type = "script"},
["sort"] = true,
["sckat"] = boolean,--sccat
["sccat"] = {boolean, alias_of = "sckat"},
["nekatcure"] = boolean,--noposcat
["noposcat"] = {boolean, alias_of = "nekatcure"},
["nekatçendterm"] = boolean,--nomultiwordcat
["nomultiwordcat"] = {boolean, alias_of = "nekatçendterm"},
["nekatcins"] = boolean,--nogendercat
["nogendercat"] = {boolean, alias_of = "nekatcins"},
["nekatpalîndrom"] = boolean,--nopalindromecat
["nopalindromecat"] = {boolean, alias_of = "nekatpalîndrom"},
["serlînkneke"] = boolean,--nolinkhead
["nolinkhead"] = {boolean, alias_of = "serlînkneke"},
["neformtr"] = boolean,
["form"] = true,
["formaalt"] = boolean, --altform EXPERIMENTAL: see [[Wiktionary:Beer parlour/2024/June#Decluttering the altform mess]]
[2] = list_allow_holes,
["cuda"] = list_allow_holes,
["id"] = true,
["tr"] = list_allow_holes,
["ts"] = list_allow_holes,
["gloss"] = true, -- bo çi ye? En.wikt bi kar neyîne
["c"] = {list = true}, --ji bo lêkeran cure, ji bo navdêran cins(iyet)
["c\1etîk"] = list_allow_holes, --etîketek ji bo cins(iyet)
["c\1ref"] = list_allow_holes,--çavkanî ji bo cins(iyet)
["z"] = {list = true, alias_of = "c"},
["z\1qual"] = {list = true, alias_of = "c\1etîk"},
["z\1ref"] = {list = true, alias_of = "c\1ref"},
["j"] = {list = true}, -- jimar
["m"] = list_allow_holes,
["m\1tr"] = list_allow_holes,
["n"] = list_allow_holes,
["n\1tr"] = list_allow_holes,
["nt"] = list_allow_holes,
["nt\1tr"] = list_allow_holes,
["p"] = list_allow_holes,
["p\1tr"] = list_allow_holes,
["y"] = list_allow_holes,
["y\1tr"] = list_allow_holes,
["np"] = list_allow_holes,-- forma nêr ya pirjimar
["np\1tr"] = list_allow_holes,
["mp"] = list_allow_holes,-- forma mê ya pirjimar
["mp\1tr"] = list_allow_holes,
["lk"] = list_allow_holes, --forma lêker
["nd"] = list_allow_holes, --forma navdêr
["niha"] = list_allow_holes, -- rehê dema niha
["niha\1tr"] = list_allow_holes,
["borî"] = list_allow_holes, -- rehê dema borî
["borî\1tr"] = list_allow_holes,
["subj"] = list_allow_holes, -- rehê dema bilanî
["subj\1tr"] = list_allow_holes,
["sûp"] = list_allow_holes, -- forma sûperlatîv
["sûp\1tr"] = list_allow_holes,
["komp"] = list_allow_holes, -- forma komparatîv
["komp\1tr"] = list_allow_holes,
["gir"] = list_allow_holes, -- herfa mezin
["gir\1tr"] = list_allow_holes,
["hûr"] = list_allow_holes, -- herfa biçûk
["hûr\1tr"] = list_allow_holes,
["hanja"] = list_allow_holes, -- hanja
["hanja\1tr"] = list_allow_holes,
})
end
function export.cure(frame)
local m_headword = require("Module:headword")
local function track(page)
require("Module:debug/track")("headword/templates/" .. page)
return true
end
local args = get_args(frame)
local lang = args[1]
local kod = lang:getCode()
local ziman = lang:getCanonicalName()
-- Get language and script information
local data = {}
local sc = args["sc"]
local sccode
if sc then
sccode = sc:getCode()
end
data.sccat = args["sckat"]
data.lang = lang
data.sc = sc
data.heads = args[2] or args["cuda"]
data.id = args["id"]
data.translits = args["tr"]
data.transcriptions = args["ts"]
data.gloss = args["gloss"]
local args_c = args["c"]
-- This shouldn't really happen.
for i = 1,args["cuda"].maxindex do
if not args["cuda"][i] then
track("head-with-holes")
end
end
-- Part-of-speech category
local cureye_rezimani = frame.args["nav"]
data.noposcat = args["nekatcure"]
local bike_form = args["form"] --form=erê binivîse ji bo ku formên navdêran lêkeran hwd. be
if bike_form == "erê" then
cureye_rezimani = "formên " .. cureye_rezimani .. "an"
end
-- Check for headword aliases and then pluralize if the POS term does not have an invariable plural.
data.pos_category = cureye_rezimani
-- Additional categories.
data.categories = {}
data.whole_page_categories = {}
data.nomultiwordcat = args["nekatçendterm"]
data.nogendercat = args["nekatcins"]
data.nopalindromecat = args["nekatpalîndrom"]
local pagename = mw.title.getCurrentTitle().text
-- Headword linking
data.nolinkhead = args["serlînkneke"]
if args["neformtr"] then
data.inflections = {enable_auto_translit = false}
else
data.inflections = {enable_auto_translit = true}
end
if bike_form == "-" and cureye_rezimani == "rengdêr" then
insert(data.categories, 'Rengdêrên neqiyasbar bi ' .. ziman )
insert(data.inflections, { label = ferhengok("neqiyasbar")})
end
-- EXPERIMENTAL: see [[:en:Wiktionary:Beer parlour/2024/June#Decluttering the altform mess]]
local forceformaalt = {}
local ku_sc_arab
if kod == "ku" then
if sccode == "Arab" or sccode == "ku-Arab" then
ku_sc_arab = "erê"
else
local check_sc = lang:findBestScript(pagename)
if check_sc:getCode() == "ku-Arab" then
ku_sc_arab = "erê"
end
end
if ku_sc_arab == "erê" then
insert(forceformaalt, true)
insert(data.categories, "Peyvên " ..ziman .. " bi alfabeya erebî" )
data.altform = forceformaalt
else
data.altform = args["formaalt"]
end
else
data.altform = args["formaalt"]
end
-- Inflected forms
-- Assuming the parameters are named like "m1tr", "n1tr", etc.
local inflection_labels = {
["m"] = "forma mê",
["n"] = "forma nêr",
["nt"] = "forma nêtar",
["p"] = "forma pirjimar",
["y"] = "forma yekjimar",
["np"] = "forma nêr ya pirjimar",
["mp"] = "forma mê ya pirjimar",
["lk"] = "forma lêker",
["nd"] = "forma navdêr",
["gir"] = "girek",
["hûr"] = "hûrek",
["hanja"] = "hanja",
["sûp"] = "forma sûperlatîv",
["komp"] = "forma komparatîv",
["niha"] = "rehê dema niha",
["borî"] = "rehê dema borî",
["subj"] = "rehê dema bilanî",
}
for code, label in pairs(inflection_labels) do
local values = args[code] -- This is a list (could have holes)
if values and values.maxindex > 0 then
local infl_part = { label = label }
-- Get the transliteration list for this code
local tr_list = args[code .. "tr"]
for i = 1, values.maxindex do
if values[i] and values[i] ~= "" then
-- Get the corresponding transliteration if available
local tr_value = tr_list and tr_list[i]
insert(infl_part, { term = values[i], translit = tr_value })
end
end
if #infl_part > 0 then
insert(data.inflections, infl_part)
end
end
end
local aspect_tab = {
['împf'] = 'împerfektîv',
['impf'] = 'împerfektîv',
['pf'] = 'perfektîv',
['gh'] = 'gerguhêz',
['ngh'] = 'negerguhêz',
}
local daristin_tab = {
['x'] = 'xwerû',
['p'] = 'pêkhatî',
['h'] = 'hevedudanî',
['b'] = 'biwêjî',
}
local pos_for_gender_number_cat = {
["navdêr"] = "navdêrên",
["serenav"] = "serenavên",
["paşgir"] = "paşgirên",
["cînav"] = "cînavên",
}
local cureyen_lekere = {}
local cure = args_c[1]
if cureye_rezimani == "lêker" and cure and cure ~= '' then
local splitted_cure = mw.text.split(cure, '-')
local c1 = splitted_cure[1]
local c2 = splitted_cure[2]
if c2 and c2 ~= '' then
if daristin_tab[c1] and aspect_tab[c2] then
insert(data.inflections, 1, { label = "lêkera " .. ferhengok(daristin_tab[c1])})
insert(cureyen_lekere, c2)
if bike_form ~= "erê" and ku_sc_arab ~= "erê" then
insert(data.categories, 'Lêkerên ' .. daristin_tab[c1] .. ' bi ' .. ziman)
insert(data.categories, 'Lêkerên ' .. daristin_tab[c1] .. ' yên ' .. aspect_tab[c2] .. ' bi ' .. ziman)
end
elseif aspect_tab[c1] and daristin_tab[c2] then
error("Invalid format: aspect code must come after leker code (e.g., x-gh, not gh-x)")
else
error("Invalid combination of codes in parameter c")
end
else
if daristin_tab[c1] then
insert(data.inflections, { label = "lêkera " .. ferhengok(daristin_tab[c1])})
elseif aspect_tab[c1] then
insert(cureyen_lekere, c1)
if bike_form ~= "erê" and ku_sc_arab ~= "erê" then
insert(data.categories, 'Lêkerên ' .. aspect_tab[c1] .. ' bi ' .. ziman)
end
elseif c1 == '?' and bike_form ~= "erê" then
insert(cureyen_lekere, "asp?")
else
error("Invalid code in cure parameter")
end
end
if #cureyen_lekere > 0 then
data.genders = cureyen_lekere
end
elseif pos_for_gender_number_cat[cureye_rezimani] and ((cure and cure ~= '') or args["j"][1]) then
local cins = args["c"]
local jimar = args["j"]
-- Only process cins if it exists and isn't empty
if cins and #cins > 0 then
-- Remove "-" values from cins
local i = 1
while i <= #cins do
if cins[i] == "-" then
table.remove(cins, i)
elseif cins[i] == "mn" and kod == "ku" then
cins[i] = "mnmane"
i = i + 1
else
i = i + 1
end
end
else
cins = {} -- Initialize as empty table if nil
end
local genders = {}
-- Pair corresponding cins and jimar values
local min_length = math.min(#cins, #jimar)
for i = 1, min_length do
insert(genders, cins[i] .. "-" .. jimar[i])
end
-- Add any remaining cins values
for i = min_length + 1, #cins do
insert(genders, cins[i])
end
-- Add any remaining jimar values
for i = min_length + 1, #jimar do
insert(genders, jimar[i])
end
if #genders > 0 then
data.genders = genders
end
elseif kod == 'ku' and (type(args_c) ~= 'table' or #args_c == 0 or args_c[1] == '' or args_c[1] == '?') and form ~= 'erê' then
local cureyen_lekere = {}
if cureye_rezimani == 'lêker' and ku_sc_arab ~= "erê" then
insert(cureyen_lekere, "asp?") --('Lêkerên bêcure ('.. ziman .. ')')
elseif cureye_rezimani == 'navdêr' and ku_sc_arab ~= "erê" then
insert(cureyen_lekere, "c?") --('Lêkerên bêcure ('.. ziman .. ')')
end
data.genders = cureyen_lekere
else
data.genders = args["c"]
end
for k, v in pairs(args["cetîk"]) do
if k ~= "maxindex" then
if data.genders[k] then
data.genders[k] = {spec = data.genders[k], qualifiers = {v}}
else
k = k == 1 and "" or tostring(k)
error(("c%setîk= specified without c%s="):format(k, k))
end
end
end
for k, v in pairs(args["cref"]) do
if k ~= "maxindex" then
if data.genders[k] then
data.genders[k] = {spec = data.genders[k], refs = {v}}
else
k = k == 1 and "" or tostring(k)
error(("c%sref= specified without c%s="):format(k, k))
end
end
end
-- Lêkerên kurmancî li gor paşgirê.
valahiheye = pagename:find(" ", nil, true)
if (kod == 'ku' and cureye_rezimani == 'lêker' and bike_form ~= 'erê' and ku_sc_arab ~= "erê" and not valahiheye) then
suffix_verb = {'în', 'andin', 'endin', 'tin', 'in', 'an', 'ûn', 'n'}
if cureye_lekere then
cure_ku = mw.text.split(cureye_lekere, '-')
else
cure_ku = ''
end
for i, suffix in ipairs(suffix_verb) do
if mw.ustring.find(pagename, suffix .. '$') then
if mw.ustring.find(pagename, ' ') then
insert(data.categories, 'Lêkerên hevedudanî yên ' .. ziman .. ' bi paşgira -' .. suffix)
elseif cure_ku[1] == 'p' or cure_ku[2] == 'p' then
insert(data.categories, 'Lêkerên pêkhatî yên ' .. ziman .. ' bi paşgira -' .. suffix)
else
insert(data.categories, 'Lêkerên ' .. ziman .. ' bi paşgira -' .. suffix)
end
break
elseif i == #suffix_verb then
insert(data.categories, 'Lêkerên ' .. ziman .. ' bi çewtiya paşgirê')
end
end
end
return m_headword.full_headword(data)
end
return export