local export = {};
local format_g = require("Module:gender and number").format_list;
local format_link = require("Module:links").full_link;
local lang = require("Module:languages").getByCode('xum');
-- these are the noun and adjective declension
local cases = {}
cases.nom = "nominative";
cases.gen = "genitive";
cases.dat = "dative";
cases.acc = "accusative";
cases = "accusative + ''" .. format_link({ term = "-en", lang = lang }) .. "''";
cases = "accusative + ''" .. format_link({ term = "-ař", lang = lang }) .. "''";
cases.abl = "ablative";
cases = "ablative + ''" .. format_link({ term = "-kom", lang = lang }) .. "''";
cases.ablkom = "ablative";
cases.voc = "vocative";
local function case_string(str)
if (str:match("-s")) then
return cases .. " sigular";
elseif (str:match("-p")) then
return cases .. " plural";
end
return cases;
end
-- these are the verb forms
local forms = {}
forms = '<abbr title="third person singular">3s</abbr> <abbr title="future">fut.</abbr> <abbr title="imperative">impv.</abbr>'
forms = '<abbr title="third person plural">3p</abbr> <abbr title="future">fut.</abbr> <abbr title="imperative">impv.</abbr>'
forms = "past participle"
local function form_string(str)
return forms;
end
-- these are the varieties
local function format_varname(short, long)
return '<abbr title="' .. long .. ] .. short .. "''</abbr>";
end
local varieties = {}
varieties.eig = format_varname("e.Ig.", "early Iguvine");
varieties.lig = format_varname("l.Ig.", "late Iguvine");
varieties.vel = format_varname("Vel.", "Velitraean");
-- this prints all the attested spellings of only one variety
local function format_var(str)
local o = varieties .. " ";
for k in string.gmatch(str:gsub(".+:", ""), "+") do
o = o .. format_link({ term = k, lang = lang }) .. ", ";
end
return o:sub(1, -3); -- remove final comma
end
-- this prints all of attested spellings of one form
local function format_allvars(str)
local value = '';
for k in string.gmatch(str, "+") do
value = value .. format_var(k) .. "<br/>";
end
return value:sub(1, -6); -- remove final <br/>
end
-- these three functions help build the wikitable
local function make_margin(str)
return '<div style="margin-left:.5em;margin-right:.5em">' .. str .. '</div>';
end
local function start_table(i, lemma, lemmatized, gendr)
return '{| class="inflection-table" style="background: #FAFAFA; border: 1px solid #d0d0d0; text-align: left;' .. (i and 'margin-top:0px; margin-bottom: 0px; width:100%;' or '') .. '"\n|- style="background: #CCC;"\n! colspan="3" | ' .. make_margin('Inflection of ' .. lemma .. '<sup><abbr title="lemmatized in the ' .. lemmatized .. '">?</abbr></sup> ' .. gendr) .. '\n';
end
local function start_line(string, second)
return '|-\n! style="background-color: #eff7ff;" | ' .. make_margin(string) .. '\n|' .. second .. '\n';
end
-- entry point for {{xum-decl}}
function export.show(frame)
local args = frame:getParent().args;
local lemma = "''" .. args .. "''";
local lemma_g = format_g({args});
local o = start_table(args.i, lemma, 'accusaitve', lemma_g);
local i = 3; local arg_i = args;
while (arg_i) do
o = o .. start_line(case_string(arg_i:gsub("/.+", "")), make_margin(format_allvars(arg_i:gsub(".+/", ""))));
i = i + 1; arg_i = args;
end
return o .. '|}';
end
-- entry point for {{xum-conj}}
function export.show_verb(frame)
local args = frame:getParent().args;
local lemma = "''" .. args .. "''";
local o = start_table(false, lemma, 'present infinitive', '');
local i = 2; local arg_i = args;
while (arg_i) do
o = o .. start_line (form_string(arg_i:gsub("/.+", "")), arg_i:match("//") and arg_i:gsub(".+//", "") or make_margin(format_allvars(arg_i:gsub(".+/", ""))));
i = i + 1; arg_i = args;
end
return o .. '|}';
end
-- entry point for {{xum-invar}}
function export.show_invar(frame)
return '*' .. format_allvars(frame:getParent().args);
end
return export;