Module:qay-verb: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "local export = {} local m_u = require('Module:utilities') local m_data = require('Module:qay-verb/data') local sub = mw.ustring.sub local find = mw.ustring.find local match = mw.ustring.match local gmatch = mw.ustring.gmatch local gsub = mw.ustring.gsub local u = mw.ustring.char local split = mw.text.split local gsplit = mw.text.gsplit local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ") local NAMESPACE = mw.title.getCurrentTitle().nsText local lang...")
 
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 15: Line 15:
local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ")
local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ")
local NAMESPACE = mw.title.getCurrentTitle().nsText
local NAMESPACE = mw.title.getCurrentTitle().nsText
local lang
local lang = require("Module:languages").getByCode("qay")


local function detect_decl(word)
local function detect_decl(word)
if word:match("a$") then
if word:match("a$") then
return "a"
return "a", {word}
elseif word:match("[eiou]$") or word:match("[eiou]y") then
elseif word:match("[eiou]$") or word:match("[aeiou]y") then
return "v"
return "v", {word}
elseif word:match("[ptkbdgmncvshrlj][sv]") or word:match("ng$") then
return "c", {word}
elseif word:match("[ptkbdgmncvshrlj][ptkbdgmncvshrlj]") then
elseif word:match("[ptkbdgmncvshrlj][ptkbdgmncvshrlj]") then
return "2c"
return "2c", {word}
else
else
return "c"
return "c", {word}
end
end
end
end
Line 40: Line 42:
if not m_data[word] then
if not m_data[word] then
if frame.args.decl then
decl_type = frame.args.decl
else
if parent_args.c and parent_args[1] then
decl_type = parent_args.c
numbers = {parent_args[1]}
else
decl_type, numbers = detect_decl(word)
end
end
if not decl_type then
-- if not decl_type then decl_type, numbers = "fricative", {root} end
error("Unknown declension '" .. decl_type .. "'")
end
args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true)
args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true)
if numbers then
if numbers then
for i, number in ipairs(numbers) do
for i, number in ipairs(numbers) do
Line 121: Line 131:
local genders = {"m", "f", "n", "in"}
local genders = {"m", "f", "n", "in"}
local columns = {"top", "cli"}
local columns = {"top", "cli"}
local others = {"imperative", "hortative", "iterative", "participle"}
local ret = {}
local ret = {}
for _, num in ipairs(numbers) do
for _, num in ipairs(numbers) do
table.insert(ret, '\n|-\n ! style="background-color:#4848B7; color:white; width: 15%" rowspan=6 | ' .. (num == "s" and "Singular" or "Plural"))
table.insert(ret, '\n|-\n ! style="background-color:#4848B7; color:white; width: 10%" rowspan=6 | ' .. (num == "s" and "Singular" or "Plural"))
for _, person in ipairs(persons) do
for _, person in ipairs(persons) do
if person == "3" then
if person == "3" then
Line 130: Line 141:
for _, g in ipairs(genders) do
for _, g in ipairs(genders) do
table.insert(ret, '! style="background-color:#DBDBFF" | ' .. tooltip(g))
table.insert(ret, '! style="background-color:#DBDBFF" | ' .. tooltip(g))
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[1] .. "_" .. person .. "_" .. num .. "_" .. gender])))
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[1] .. "_" .. person .. "_" .. num .. "_" .. g])))
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[2] .. "_" .. person .. "_" .. num .. "_" .. gender])))
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[2] .. "_" .. person .. "_" .. num .. "_" .. g])) .. '\n|-\n')
end
end
else
else
table.insert(ret, '\n! colspan=2 style="background-color:#BDBDFF; color: black;" | ' .. ordinal(person) .. '\n')
table.insert(ret, '\n! colspan=2 style="background-color:#BDBDFF; color: black;" | ' .. ordinal(person) .. '\n')
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[1] .. "_" .. person .. "_" .. num])))
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[1] .. "_" .. person .. "_" .. num])))
table.insert(ret, '\n|' .. link(show_form(data.forms[columns[2] .. "_" .. person .. "_" .. num])) .. '\n|-')
end
end
end
end
end
end
table.insert(ret, '\n|- style="border-top: double"\n')
for _, other in ipairs(others) do
table.insert(ret, '! style="background-color:#000080; color:white" colspan=3 | ' .. other .. '\n')
table.insert(ret, '| colspan=2 | ' .. link(show_form(data.forms[other])) .. '\n|-\n')
end
return table.concat(ret)
return table.concat(ret)
end
end


local navframe = [=[
local navframe = [=[
<div class="mw-collapsible" style="border-collapse: collapse; margin: 0px 0px -1px 0px; padding: 2px; border: 1px solid #aaaaaa; text-align: center; font-size: 95%; overflow: auto; width: 55%;">
<div class="mw-collapsible" style="border-collapse: collapse; margin: 0px 0px -1px 0px; padding: 2px; border: 1px solid #aaaaaa; text-align: center; font-size: 95%; overflow: auto; width: 40%;">
<div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);  background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);">''no-'' — verb (vocalic)</div>
<div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);  background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);">''{{{pagename}}}'' — verb ({{{decl_type}}})</div>
<div class="mw-collapsible-content" style="font-size: 100%;">
<div class="mw-collapsible-content" style="font-size: 100%;">
]=]
]=]
Line 151: Line 169:
{| border="1px solid #d0d0d0" style="border-collapse:collapse; background:#F9F9FF; text-align:center; width:100%" cellspacing="1" cellpadding="2"
{| border="1px solid #d0d0d0" style="border-collapse:collapse; background:#F9F9FF; text-align:center; width:100%" cellspacing="1" cellpadding="2"
|- style="background-color:#000080; color:white"
|- style="background-color:#000080; color:white"
!  &nbsp; !! colspan="2" style="width:20%" | Person !! Topicalized !! Clitic agent
!  &nbsp; !! colspan="2" style="width:15%" | Person !! Topicalized !! Clitic agent
]=] .. make_forms(data) .. [=[
]=] .. make_forms(data) .. [=[
|}</div></div>]=]
|}</div></div>]=]

Navigation menu