Модуль:ky-person
Көрүнүш
("Модуль:ky-зат атооч" барагынан багытталды)
кыргыз эли
local p = {}
local h_bg = '#DEDEDE'
local t_bg = '#F9F9F9'
local b_color = '#aaaaaa'
local i_border = '1px solid #ffffff'
local function wrap_box(title, content)
local res = '\n<div style="width:65%; border:1px solid ' .. b_color .. '; margin:10px 0; font-size:95%; font-family:sans-serif;">'
res = res .. '<div style="background:#eeeeee; padding:4px 10px; font-weight:bold; border-bottom:1px solid ' .. b_color .. ';">' .. title .. '</div>'
res = res .. '{| style="width:100%; text-align:center; border-collapse:collapse; background:' .. t_bg .. ';"\n'
res = res .. content .. '\n|}\n</div>'
return res
end
-- 4 гармония
local function harmony(word)
local map = {
['а']='A',['ы']='A',['я']='A',
['о']='O',['у']='O',['ё']='O',['ю']='O',
['е']='E',['и']='E',['э']='E',
['ө']='Ö',['ү']='Ö'
}
for i = mw.ustring.len(word),1,-1 do
local ch = mw.ustring.sub(word,i,i)
if map[ch] then return map[ch] end
end
return 'A'
end
local function high_vowel(h)
local m = { A='ы', O='у', E='и', ['Ö']='ү' }
return m[h]
end
function p.render(frame)
local word = frame.args['сөз'] or mw.title.getCurrentTitle().text
word = mw.ustring.gsub(word, "^.-:", "")
word = mw.ustring.gsub(word, "^.*/", "")
local h = harmony(word)
local i = high_vowel(h)
local forms = {
{"1", word .. "-м" .. i .. "н", word .. "-б" .. i .. "з"},
{"2", word .. "-с" .. i .. "ң", word .. "-с" .. i .. "ңар"},
{"2 (сылык)", word .. "-с" .. i .. "з", word .. "-с" .. i .. "здар"},
{"3", word, word .. "-лар"}
}
local content = '|-\n! style="background:' .. h_bg .. '; border:' .. i_border .. ';" | Жак\n'
content = content .. '! style="background:' .. h_bg .. '; border:' .. i_border .. ';" | Жекелик\n'
content = content .. '! style="background:' .. h_bg .. '; border:' .. i_border .. ';" | Көптүк\n'
for _, row in ipairs(forms) do
content = content .. '|-\n'
content = content .. '| style="border:' .. i_border .. ';" | ' .. row[1] .. '\n'
content = content .. '| style="border:' .. i_border .. ';" | ' .. row[2] .. '\n'
content = content .. '| style="border:' .. i_border .. ';" | ' .. row[3] .. '\n'
end
return wrap_box("Жак мүчөлөрдү кабыл алышы", content)
end
return p