Module:User:Balyozxane
Appearance
- This module sandbox lacks a documentation subpage. You may create it.
- Useful links: subpage list • links • transclusions • testcases • user page • user talk page • userspace
This is a private module sandbox of Balyozxane, for their own experimentation. Items in this module may be added and removed at Balyozxane's discretion; do not rely on this module's stability.
-- [[ku:Modul:ku-tewîn-nav]]
-- [[Module:User:Balyozxane/masc and fem]] [[ku:Modul:ku-tewîn-nav/mê û nêr]]
-- [[Module:User:Balyozxane/singular]] [[ku:Modul:ku-tewîn-nav/yekjimar]]
-- {{User:Balyozxane/sandbox}}
local export = {}
-- FERHENG --
-- Definite (def) = binavkirî, diyar
-- Indefinite (indef) = nebinavkirî, nediyar
-- Singular (s) = Yekjimar / Plural (p) = Pirjimar
-- Case = Rewş, awa
-- Nominative (nom)= Rewşa (awayê) navkî, netewandî, xwerû
-- Construct (cons) = Îzafe
-- Oblique (obl) = Rewşa (awayê) çemandî (tewandî)
-- Demonstrative oblique (demons_obl) = Rewşa nîşander a çemandî
-- Vocativ (voc) = Rewşa bangkirinê
local gsub = mw.ustring.gsub
local find = mw.ustring.find
-- bolden the suffix
function b(bold)
return '<b>' .. bold .. '</b>'
end
function pronounDecl(g)
if g == 'f' then return 'wê' end
if g == 'm' then return 'wî' end
end
function export.decl(title, gender, variant, bold)
local decl = {}
decl.def_nom_s = title
decl.def_nom_p = title
if (find(title, '[bcçdfghjklmnpqrsştvwxyz]$')) then
if (gender == 'm') then
decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('ê'))
decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('ên'))
decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('î'))
decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('an'))
decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('ek'))
decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('in'))
decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('ekî'))
decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('ine'))
decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('ekî'))
decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('inan'))
decl.voc_s = gsub(title, '(.)$', '%1' .. b('o'))
decl.voc_p = gsub(title, '(.)$', '%1' .. b('ino'))
elseif (gender == 'f') then
decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('a'))
decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('ên'))
decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('ê'))
decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('an'))
decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('ek'))
decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('in'))
decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('eke'))
decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('ine'))
decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('ekê'))
decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('inan'))
decl.voc_s = gsub(title, '(.)$', '%1' .. b('ê'))
decl.voc_p = gsub(title, '(.)$', '%1' .. b('ino'))
end
elseif (find(title, '[aeêiîouû]$') and variant == '2') then
if (gender == 'm') then
decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('yê'))
decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên'))
if (find(title, '[î]$')) then
decl.def_obl_s = title
else
decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yî'))
end
decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan'))
decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek'))
decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin'))
decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yekî'))
decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine'))
decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekî'))
decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan'))
decl.voc_s = gsub(title, '(.)$', '%1' .. b('yo'))
decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino'))
elseif (gender == 'f') then
decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('ya'))
decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên'))
if (find(title, '[ê]$')) then
decl.def_obl_s = title
else
decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yê'))
end
decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan'))
decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek'))
decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin'))
decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yeke'))
decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine'))
decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekê'))
decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan'))
decl.voc_s = gsub(title, '(.)$', '%1' .. b('yê'))
decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino'))
end
elseif (find(title, '[aîoû]$')) then
if (gender == 'm') then
decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('yê'))
decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên'))
if (find(title, '[î]$')) then
decl.def_obl_s = title
else
decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yî'))
end
decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan'))
decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek'))
decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin'))
decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yekî'))
decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine'))
decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekî'))
decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan'))
decl.voc_s = gsub(title, '(.)$', '%1' .. b('yo'))
decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino'))
elseif (gender == 'f') then
decl.def_cons_s = gsub(title, '(.)$', '%1' .. b('ya'))
decl.def_cons_p = gsub(title, '(.)$', '%1' .. b('yên'))
decl.def_obl_s = gsub(title, '(.)$', '%1' .. b('yê'))
decl.def_obl_p = gsub(title, '(.)$', '%1' .. b('yan'))
decl.indef_nom_s = gsub(title, '(.)$', '%1' .. b('yek'))
decl.indef_nom_p = gsub(title, '(.)$', '%1' .. b('yin'))
decl.indef_cons_s = gsub(title, '(.)$', '%1' .. b('yeke'))
decl.indef_cons_p = gsub(title, '(.)$', '%1' .. b('yine'))
decl.indef_obl_s = gsub(title, '(.)$', '%1' .. b('yekê'))
decl.indef_obl_p = gsub(title, '(.)$', '%1' .. b('yinan'))
decl.voc_s = gsub(title, '(.)$', '%1' .. b('yê'))
decl.voc_p = gsub(title, '(.)$', '%1' .. b('yino'))
end
elseif (find(title, '[e]$')) then
if (gender == 'm') then
decl.def_cons_s = gsub(title, '(.)$', b('ê'))
decl.def_cons_p = gsub(title, '(.)$', b('ên'))
decl.def_obl_s = gsub(title, '(.)$', b('î'))
decl.def_obl_p = gsub(title, '(.)$', b('an'))
decl.indef_nom_s = gsub(title, '(.)$', 'e' .. b('k'))
decl.indef_nom_p = gsub(title, '(.)$', b('in'))
decl.indef_cons_s = gsub(title, '(.)$', 'e' .. b('kî'))
decl.indef_cons_p = gsub(title, '(.)$', b('ine'))
decl.indef_obl_s = gsub(title, '(.)$', 'e' .. b('kî'))
decl.indef_obl_p = gsub(title, '(.)$', b('inan'))
decl.voc_s = gsub(title, '(.)$', b('o'))
decl.voc_p = gsub(title, '(.)$', b('ino'))
elseif (gender == 'f') then
decl.def_cons_s = gsub(title, '(.)$', b('a'))
decl.def_cons_p = gsub(title, '(.)$', b('ên'))
decl.def_obl_s = gsub(title, '(.)$', b('ê'))
decl.def_obl_p = gsub(title, '(.)$', b('an'))
decl.indef_nom_s = gsub(title, '(.)$', 'e' .. b('k'))
decl.indef_nom_p = gsub(title, '(.)$', b('in'))
decl.indef_cons_s = gsub(title, '(.)$', 'e' .. b('ke'))
decl.indef_cons_p = gsub(title, '(.)$', b('ine'))
decl.indef_obl_s = gsub(title, '(.)$', 'e' .. b('kê'))
decl.indef_obl_p = gsub(title, '(.)$', b('inan'))
decl.voc_s = gsub(title, '(.)$', b('ê'))
decl.voc_p = gsub(title, '(.)$', b('ino'))
end
elseif (find(title, '[ê]$')) then
if (gender == 'm') then
decl.def_cons_s = gsub(title, '(.)$', b('iyê'))
decl.def_cons_p = gsub(title, '(.)$', b('iyên'))
decl.def_obl_s = gsub(title, '(.)$', b('iyî'))
decl.def_obl_p = gsub(title, '(.)$', b('iyan'))
decl.indef_nom_s = gsub(title, '(.)$', b('iyek'))
decl.indef_nom_p = gsub(title, '(.)$', b('iyin'))
decl.indef_cons_s = gsub(title, '(.)$', b('iyekî'))
decl.indef_cons_p = gsub(title, '(.)$', b('iyine'))
decl.indef_obl_s = gsub(title, '(.)$', b('iyekî'))
decl.indef_obl_p = gsub(title, '(.)$', b('iyinan'))
decl.voc_s = gsub(title, '(.)$', b('iyo'))
decl.voc_p = gsub(title, '(.)$', b('iyino'))
elseif (gender == 'f') then
decl.def_cons_s = gsub(title, '(.)$', b('iya'))
decl.def_cons_p = gsub(title, '(.)$', b('iyên'))
if (find(title, '[ê]$')) then
decl.def_obl_s = title
else
decl.def_obl_s = gsub(title, '(.)$', b('iyê'))
end
decl.def_obl_p = gsub(title, '(.)$', b('iyan'))
decl.indef_nom_s = gsub(title, '(.)$', b('iyek'))
decl.indef_nom_p = gsub(title, '(.)$', b('iyin'))
decl.indef_cons_s = gsub(title, '(.)$', b('iyeke'))
decl.indef_cons_p = gsub(title, '(.)$', b('iyine'))
decl.indef_obl_s = gsub(title, '(.)$', b('iyekê'))
decl.indef_obl_p = gsub(title, '(.)$', b('iyinan'))
decl.voc_s = gsub(title, '(.)$', b('iyê'))
decl.voc_p = gsub(title, '(.)$', b('iyino'))
end
end
-- îy --> iy + link
for i, v in pairs(decl) do
decl[i] = gsub(decl[i], 'î<b>y', '<b>iy')
if bold == 'no' then
decl[i] = gsub(decl[i], '<b>', '')
decl[i] = gsub(decl[i], '</b>', '')
else
local lang = require("Module:languages").getByCode("kmr")
local alt = decl[i]
decl[i] = gsub(decl[i], '<b>', '')
decl[i] = gsub(decl[i], '</b>', '')
local term = decl[i]
local form = gsub(i, '_', '|')
decl[i] = require("Module:links").full_link(
{
lang = lang,
term = term,
alt = alt,
accel = {form = form, gender = gender, lemma = title}
})
end
end
-- zêdekirina cînavên wê/wî/wan
decl.def_demons_obl_s = '[[' .. pronounDecl(gender) .. ']] ' .. decl.def_obl_s
decl.def_demons_obl_p = '[[wan]]' .. ' ' .. decl.def_obl_p
return decl
end
local function genderTable(gender)
if (gender == 'm') then return 'masculine gender'
elseif (gender == 'f') then return 'feminine gender'
end
end
function export.declension(frame)
local args = frame:getParent().args
local gender = args[1]
local singular = args[2]
local variant = args['variant']
local title = args['title']
if title then
title = title
else
title = mw.title.getCurrentTitle().subpageText
end
decl_mf = require('Module:User:Balyozxane/masc and fem').mf
decl_singular = require('Module:User:Balyozxane/singular').singular
if (gender == 'mf') then
return decl_mf(title, variant)
elseif (singular == 'y') then
return decl_singular(title, gender, variant)
else
return
'<div class="NavFrame" style="width:30%">'
..'\n<div class="NavHead" style="">declension of ' ..title.. '</div>'
..'\n<div class="NavContent">'
..'\n{| colspan="5" border="1" style="border-collapse:collapse; background-color:white; clear:right; width:100%; " class="inflection-table"'
..'\n|-'
..'\n! colspan="3" align="center" |Definite ' .. genderTable(gender)
..'\n|-'
..'\n! style="background-color:#FFFFE0; text-align:left;" | Case'
..'\n! colspan="1" style="background-color:#FFFFE0;" | Singular'
..'\n! colspan="1" style="background-color:#FFFFE0;" | Plural'
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Nominative'
..'\n|' .. export.decl(title, gender, variant)["def_nom_s"]
..'\n|' .. export.decl(title, gender, variant)["def_nom_p"]
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Construct'
..'\n|' .. export.decl(title, gender, variant)["def_cons_s"]
..'\n|' .. export.decl(title, gender, variant)["def_cons_p"]
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Oblique'
..'\n|' .. export.decl(title, gender, variant)["def_obl_s"]
..'\n|' .. export.decl(title, gender, variant)["def_obl_p"]
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Demonstrative oblique'
..'\n|' .. export.decl(title, gender, variant)["def_demons_obl_s"]
..'\n|' .. export.decl(title, gender, variant)["def_demons_obl_p"]
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Vocative'
..'\n|' .. export.decl(title, gender, variant)["voc_s"]
..'\n|' .. export.decl(title, gender, variant)["voc_p"]
..'\n|-'
..'\n! colspan="5" align="center" |Indefinite ' .. genderTable(gender)
..'\n|-'
..'\n!style="background-color:#FFFFE0; text-align:left;" | Case'
..'\n!colspan="1" style="background-color:#FFFFE0;" | Singular'
..'\n!colspan="1" style="background-color:#FFFFE0;" | Plural'
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Nominative'
..'\n|' .. export.decl(title, gender, variant)["indef_nom_s"]
..'\n|' .. export.decl(title, gender, variant)["indef_nom_p"]
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Construct'
..'\n|' .. export.decl(title, gender, variant)["indef_cons_s"]
..'\n|' .. export.decl(title, gender, variant)["indef_cons_p"]
..'\n|-'
..'\n| style="background-color:#f8f9fa; text-align:left;" | Oblique'
..'\n|' .. export.decl(title, gender, variant)["indef_obl_s"]
..'\n|' .. export.decl(title, gender, variant)["indef_obl_p"]
..'\n|}</div></div>'
end
end
return export