45,647
edits
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
local export = {} | local export = {} | ||
local endings = { | |||
["a"] = "I", ["e"] = "II", ["z"] = "IIr", ["ie"] = "III", | |||
} | |||
if | function export.detect_decl(word, class) | ||
local decl = | if class then | ||
return decl, {sub(word, 1, | local decl = class | ||
return decl, {sub(word, 1, (decl == "III" and -3 or -2))} | |||
else | else | ||
for ending, decl in pairs(endings) do | for ending, decl in pairs(endings) do | ||
Line 39: | Line 32: | ||
end | end | ||
end | end | ||
end | end | ||
Line 46: | Line 38: | ||
local parent_args = frame:getParent().args | local parent_args = frame:getParent().args | ||
local decl = {} | local decl = {} | ||
local word = NAMESPACE == "Template" and " | local word = NAMESPACE == "Template" and "rōva" or parent_args.word or PAGENAME | ||
local args = {} | local args = {} | ||
if not | if not m_data[word] then | ||
if frame.args.decl then | if frame.args.decl then | ||
decl_type = frame.args.decl | decl_type = frame.args.decl | ||
else | else | ||
decl_type, numbers = export.detect_decl(word, parent_args.c) | |||
end | end | ||
Line 68: | Line 53: | ||
end | end | ||
args = require("Module:parameters").process(parent_args, | args = require("Module:parameters").process(parent_args, m_data[decl_type].params, true) | ||
end | end | ||
local | local data = {forms = {}, categories = {}} | ||
data.head = parent_args["head"] or nil | |||
-- Generate the forms | -- Generate the forms | ||
if | if m_data[word] then | ||
m_data[word](parent_args, data) | |||
else | else | ||
m_data[decl_type](args, data) | |||
end | end | ||
-- Make the table | -- Make the table | ||
return make_table( | return make_table(data) | ||
end | end | ||
function make_table( | function make_table(data) | ||
local function show_form(form) | local function show_form(form) | ||
Line 120: | Line 98: | ||
local function repl(param) | local function repl(param) | ||
if param == "decl_type" then | if param == "decl_type" then | ||
return | return data.decl_type | ||
elseif param == "title" then | elseif param == "title" then | ||
return | return data.forms.nom_sg[1] | ||
elseif param == "pagename" and NAMESPACE == "Template" then | elseif param == "pagename" and NAMESPACE == "Template" then | ||
return "vala" | return "vala" | ||
Line 128: | Line 106: | ||
return PAGENAME | return PAGENAME | ||
else | else | ||
return show_form( | return show_form(data.forms[param]) | ||
end | end | ||
end | end | ||
local function make_cases(data, | local function make_cases(data, pre) | ||
local cases = {"nominative", "accusative", "genitive", "dative", "locative", "instrumental", "comitative", "vocative"} | local cases = {"nominative", "accusative", "genitive", "dative", "locative", "instrumental", "comitative", "vocative"} | ||
local genders = {"lunar", "solar", "terrestrial", "aquatic"} | |||
local ret = {} | local ret = {} | ||
Line 140: | Line 119: | ||
table.insert(ret, "|- \n! style=\"background-color: #dcffed;\ |" .. case .. "\n") | table.insert(ret, "|- \n! style=\"background-color: #dcffed;\ |" .. case .. "\n") | ||
table.insert(ret, "| style=\"background-color: #edfff6;\" | " .. link(show_form(pass.forms[case_short .. "_sg"])) .. "\n") | table.insert(ret, "| style=\"background-color: #edfff6;\" | " .. link(show_form(pass.forms[case_short .. "_sg"])) .. "\n") | ||
if | if data.forms[case_short .. "_pl"] or data.forms[case_short .. "_pa"] or data.forms[case_short .. "_co"] then | ||
table.insert(ret, "| style=\"background-color: #edfff6;\" | " .. link(show_form(pass.forms[case_short .. "_pl"])) .. "\n") | table.insert(ret, "| style=\"background-color: #edfff6;\" | " .. link(show_form(pass.forms[case_short .. "_pl"])) .. "\n") | ||
table.insert(ret, "| style=\"background-color: #edfff6;\" | " .. link(show_form(pass.forms[case_short .. "_pa"])) .. "\n") | table.insert(ret, "| style=\"background-color: #edfff6;\" | " .. link(show_form(pass.forms[case_short .. "_pa"])) .. "\n") | ||
Line 170: | Line 149: | ||
! {{#invoke:getn|show_list|s|ol}} | ! {{#invoke:getn|show_list|s|ol}} | ||
! {{#invoke:getn|show_list|p|pa}} | ! {{#invoke:getn|show_list|p|pa}} | ||
|- ]=] .. make_cases(data, | |- ]=] .. make_cases(data, true) .. [=[ | ||
|}<ul style="margin-left:0px;"></ul> | |}<ul style="margin-left:0px;"></ul> | ||
{| border="1px solid white" style="border-collapse: collapse; background:#ffffff; width:100%; text-align:center;" cellspacing="1" cellpadding="2" | {| border="1px solid white" style="border-collapse: collapse; background:#ffffff; width:100%; text-align:center;" cellspacing="1" cellpadding="2" | ||
Line 188: | Line 167: | ||
! {{#invoke:getn|show_list|s|ol}} | ! {{#invoke:getn|show_list|s|ol}} | ||
! {{#invoke:getn|show_list|p|pa}} | ! {{#invoke:getn|show_list|p|pa}} | ||
|- style="background-color:#fdfdfd;" ]=] .. make_cases(data, | |- style="background-color:#fdfdfd;" ]=] .. make_cases(data, false) .. [=[ | ||
|}</div></div>]=] | |}</div></div>]=] | ||