local aux = {}
local forms = {}
local export = {}
local theme_vowels = {}
local vl_translit = require("Module:la-vul-translit")
local fallback_conj = {
= "4th",
= "3rd",
}
local forms_to_use = {
= {"top", "nom_inf", "nom_pres_part", "nom_gerund", "nom_past_part", "ind_header", "ind_pres", "ind_imperf", "ind_perf", "ind_pluperf",
"ind_fut_perf", "ind_fut", "ind_cond", "ind_comp_header", "ind_comp_perf", "ind_comp_pluperf", "ind_comp_fut_perf",
"sub_header", "sub_pres", "sub_imperf", "sub_pluperf", "imp_header", "imp", "bottom", "categories"},
= {"top", "nom_inf", "nom_pres_part", "nom_gerund", "nom_past_part", "ind_header", "ind_pres", "ind_imperf", "ind_perf", "ind_fut_perf",
"ind_comp_header", "ind_comp_perf", "ind_comp_pluperf", "ind_comp_fut_perf", "ind_comp_fut",
"sub_header", "sub_pres", "sub_pluperf", "bottom", "categories"},
= {"top", "nom_inf", "nom_pres_part", "nom_gerund", "nom_past_part", "ind_header", "ind_pres", "ind_imperf", "ind_perf",
"ind_comp_header", "ind_comp_perf", "ind_comp_pluperf", "ind_comp_fut_perf", "ind_comp_fut",
"sub_header", "sub_pres", "sub_imperf", "bottom", "categories"}
}
local simple_colspan = { = "7", = "4", = "3"}
local comp_colspan = { = "3", = "4", = "4"}
local label_classes = { = "indicative", = "subjunctive", = "imperative"}
local long_family_names = { = "Italo-Western Romance", = "Eastern Romance", = "Sardinian"}
local refl_prons = {"me", "te", "se", "nos", "vos", "se"}
local refl_add_to_end = { = true, = true, = true}
local function show_forms(words, family, form, person, refl)
if mw.ustring.find(words, "—") then return "—" end
local result = vl_translit.convert_words(words, family)
if refl and form ~= "nom_past_part" then
if refl_add_to_end then
result = result .. " " .. refl_prons
else
result = "*" .. refl_prons .. " " .. mw.ustring.sub(result, 2, -1)
end
end
return result
end
local function get_forms(form, conj)
return (form == nil) and form] or form
end
function forms.top()
return [=[<div class="NavFrame">
<div class="NavHead"> {{{family}}} conjugation of ''*{{{inf}}}''</div>
<div class="NavContent">
{| class="roa-inflection-table" data-toggle-category="inflection"]=] .. "\n|-\n"
end
function forms.ind_header(args, conj, family)
return [=[
! colspan="2" rowspan="2" class="roa-indicative-left-rail" | indicative
! colspan="3" class="roa-indicative-left-rail" | singular
! colspan="3" class="roa-indicative-left-rail" | plural
|-
! class="roa-indicative-left-rail" | first
! class="roa-indicative-left-rail" | second
! class="roa-indicative-left-rail" | third
! class="roa-indicative-left-rail" | first
! class="roa-indicative-left-rail" | second
! class="roa-indicative-left-rail" | third
|-
! rowspan="]=] .. simple_colspan .. =] .. "\n"
end
function forms.ind_comp_header(args, conj, family)
return [=[
! rowspan="]=] .. comp_colspan .. =] .. "\n"
end
function forms.sub_header()
return [=[
! colspan="2" rowspan="2" class="roa-subjunctive-left-rail" | subjunctive
! colspan="3" class="roa-subjunctive-left-rail" | singular
! colspan="3" class="roa-subjunctive-left-rail" | plural
|-
! class="roa-subjunctive-left-rail" | first
! class="roa-subjunctive-left-rail" | second
! class="roa-subjunctive-left-rail" | third
! class="roa-subjunctive-left-rail" | first
! class="roa-subjunctive-left-rail" | second
! class="roa-subjunctive-left-rail" | third]=] .. "\n|-\n"
end
function forms.imp_header()
return [=[
! colspan="2" rowspan="2" class="roa-imperative-left-rail" | imperative
! colspan="3" class="roa-imperative-left-rail" | singular
! colspan="3" class="roa-imperative-left-rail" | plural
|-
! class="roa-imperative-left-rail" | —
! class="roa-imperative-left-rail" | second
! class="roa-imperative-left-rail" | —
! class="roa-imperative-left-rail" | —
! class="roa-imperative-left-rail" | second
! class="roa-imperative-left-rail" | —]=] .. "\n|-\n"
end
function forms.bottom()
return "|}</div></div>"
end
local function loop_over(self, args, conj, family)
local names = tostring(self)
local ret = {'! class="roa-' .. label_classes, 1, 3)] .. '-left-rail" colspan=' ..
(mw.ustring.find(names, "ind") and "1" or "2") .. '| ' .. names}
local conj_endings = get_forms(self, conj)
for i, v in ipairs(conj_endings) do
table.insert(ret, "\n| " .. show_forms(args .. conj_endings, family, names, i, args))
end
return table.concat(ret) .. "\n|-\n"
end
local function loop_over_perf(self, args, conj, family)
local names = tostring(self)
local ret = {'! class="roa-' .. label_classes, 1, 3)] .. '-left-rail" colspan=' ..
(mw.ustring.find(names, "ind") and "1" or "2") .. '| ' .. names}
perf_stem = args or args
local conj_endings = get_forms(self, conj)
for i, v in ipairs(conj_endings) do
table.insert(ret, "\n| " .. show_forms(perf_stem .. conj_endings, family, names, i, args))
end
return table.concat(ret) .. "\n|-\n"
end
aux.ind_comp_perf = {
= {"sum ", "es ", "est ", "sumus ", "estes ", "sunt "},
= {"habeō ", "habēs ", "habet ", "habēmus ", "habētis ", "habent "}
}
aux.ind_comp_pluperf = {
= {"eram ", "erās ", "erat ", "erāmus ", "erātis ", "erant "},
= {"habēbam ", "habēbās ", "habēbat ", "habēbāmu ", "habēbātis ", "habēbant "}
}
aux.ind_comp_fut_perf = {
= {"essere habeō ", "essere habēs ", "essere habet ", "essere habēmus ", "essere habētis ", "essere habent "},
= {"habēre habeō ", "habēre habēs ", "habēre habet ", "habēre habēmus ", "habēre habētis ", "habēre habent "}
}
aux.ind_comp_fut = {
= {"voleō ", "velis ", "volet ", "volēmus ", "volētis ", "volēnt "},
= {"habeō ad ", "habēs ad ", "habet ad ", "habēmus ad ", "habētis ad ", "habent ad "}
}
forms.nom_inf = {
= {"āre"},
= {"ēre"},
= {"ere"},
= {"īre"},
}
setmetatable(forms.nom_inf, {__call = function(self, args, conj, family)
return '! colspan="3" class="roa-nonfinite-header" | infinitive\n| ' .. show_forms(args .. get_forms(self, conj), family, "nom_inf", 3, args) .. "\n|-\n"
end,
__tostring = function() return "infinitive" end
})
forms.nom_pres_part = {
= {"antis"},
= {"entis"},
= {"entis"},
= {"entis"},
}
setmetatable(forms.nom_pres_part, {__call = function(self, args, conj, family)
return '! colspan="4" class="roa-nonfinite-header" | present participle\n| ' .. show_forms(args .. get_forms(self, conj), family, "nom_pres_part", 3, args) .. "\n|-\n"
end,
__tostring = function() return "present participle" end
})
forms.nom_gerund = {
= {"andō"},
= {"endō"},
= {"endō"},
= {"endō"},
}
setmetatable(forms.nom_gerund, {__call = function(self, args, conj, family)
return '! colspan="4" class="roa-nonfinite-header" | gerund\n| ' .. show_forms(args .. get_forms(self, conj), family, "nom_gerund", 3, args) .. "\n|-\n"
end,
__tostring = function() return "gerund" end
})
forms.nom_past_part = {
= {"ātum"},
= {"ūtum"},
= {"ūtum"},
= {"ītum"},
}
setmetatable(forms.nom_past_part, {__call = function(self, args, conj, family)
return '! colspan="4" class="roa-nonfinite-header" | past participle\n| ' ..
show_forms(args or (args .. get_forms(self, conj)), family, "nom_past_part", 3, args) .. "\n|-\n"
end,
__tostring = function() return "past participle" end
})
forms.ind_pres = {
= {"ō", "ās", "at", "āmus", "ātis", "ant"},
= {"eō", "ēs", "et", "ēmus", "ētis", "ēnt"},
= {"ō", "is", "it", "imus", "itis", "unt"},
= {"iō", "īs", "īt", "īmus", "ītis", "unt"},
= {"ēscō", "ēscis", "ēscit", "īmus", "ītis", "ēscunt"},
= {"iō", "is", "it", "imus", "itis", "unt"}
}
setmetatable(forms.ind_pres, {__call = loop_over, __tostring = function() return {"present", "ind_pres"} end})
forms.ind_imperf = {
= {"ābam", "ābās", "ābat", "ābāmus", "ābātis", "ābānt"},
= {"ēbam", "ēbās", "ēbat", "ēbāmus", "ēbātis", "ēbānt"},
= {"ēbam", "ēbās", "ēbat", "ēbāmus", "ēbātis", "ēbānt"},
= {"ībam", "ībās", "ībat", "ībāmus", "ībātis", "ībānt"},
}
setmetatable(forms.ind_imperf, {__call = loop_over, __tostring = function() return {"imperfect", "ind_imperf"} end})
forms.ind_perf = {
= {"āī", "āstī", "'aut", "āmmus", "āstis", "ārunt"},
= {"ī", "istī", "it", "immus", "istis", "ērunt"},
= {"ī", "istī", "it", "immus", "istis", "ērunt"},
= {"īī", "īstī", "'īt", "īmmus", "īstis", "īrunt"}
}
setmetatable(forms.ind_perf, {__call = loop_over_perf, __tostring = function() return {"perfect", "ind_perf"} end})
forms.ind_pluperf = {
= {"āram", "ārās", "'ārat", "ārāmus", "ārātis", "ārant"},
= {"eram", "erās", "'erat", "erāmus", "erātis", "erant"},
= {"eram", "erās", "'erat", "erāmus", "erātis", "erant"},
= {"īram", "īrās", "'īrat", "īrāmus", "īrātis", "īrant"},
}
setmetatable(forms.ind_pluperf, {__call = loop_over_perf, __tostring = function() return {"pluperfect", "ind_pluperf"} end})
forms.ind_fut_perf = {
= {"ārim", "āris", "ārit", "ārimus", "āritis", "ārint"},
= {"erim", "eris", "'erit", "erimus", "eritis", "erint"},
= {"erim", "eris", "'erit", "erimus", "eritis", "erint"},
= {"īrim", "īris", "īrit", "īrimus", "īritis", "īrint"}
}
setmetatable(forms.ind_fut_perf, {__call = loop_over_perf, __tostring = function() return {"future perfect", "ind_fut_perf"} end})
forms.ind_fut = {
= {"āre habeō", "āre habēs", "āre habet", "āre habēmus", "āre habētis", "āre habent"},
= {"ēre habeō", "ēre habēs", "ēre habet", "ēre habēmus", "ēre habētis", "ēre habent"},
= {"ere habeō", "ere habēs", "ere habet", "ere habēmus", "ere habētis", "ere habent"},
= {"īre habeō", "īre habēs", "īre habet", "īre habēmus", "īre habētis", "īre habent"}
}
setmetatable(forms.ind_fut, {__call = loop_over, __tostring = function() return {"future", "ind_fut"} end})
forms.ind_cond = {
= {"āre habēbam", "āre habēbās", "āre habēbat", "āre habēbāmus", "āre habēbātis", "āre habēbant"},
= {"ēre habēbam", "ēre habēbās", "ēre habēbat", "ēre habēbāmus", "ēre habēbātis", "ēre habēbant"},
= {"ere habēbam", "ere habēbās", "ere habēbat", "ere habēbāmus", "ere habēbātis", "ere habēbant"},
= {"īre habēbam", "īre habēbās", "īre habēbat", "īre habēbāmus", "īre habēbātis", "īre habēbant"}
}
setmetatable(forms.ind_cond, {__call = loop_over, __tostring = function() return {"conditional", "ind_cond"} end})
function forms.ind_comp_perf(args, conj, family)
local aux_to_use = args or "habēre"
local ret = {'! class="roa-indicative-left-rail" | perfect'}
for i, v in ipairs(aux.ind_comp_perf) do
table.insert(ret, "\n| " .. show_forms(v .. " " .. (args.pastpart or (args .. get_forms(forms.nom_past_part, conj))), family, "ind_comp_perf", i, args))
end
return table.concat(ret) .. "\n|-\n"
end
function forms.ind_comp_pluperf(args, conj, family)
local aux_to_use = args or "habēre"
local ret = {'! class="roa-indicative-left-rail" | pluperfect'}
for i, v in ipairs(aux.ind_comp_pluperf) do
table.insert(ret, "\n| " .. show_forms(v .. " " .. (args.pastpart or (args .. get_forms(forms.nom_past_part, conj))), family, "ind_comp_pluperf", i, args))
end
return table.concat(ret) .. "\n|-\n"
end
function forms.ind_comp_fut_perf(args, conj, family)
local aux_to_use = args or "habēre"
local ret = {'! class="roa-indicative-left-rail" | future perfect'}
for i, v in ipairs(aux.ind_comp_fut_perf) do
table.insert(ret, "\n| " .. show_forms(v .. " " .. (args.pastpart or (args .. get_forms(forms.nom_past_part, conj))), family, "ind_comp_fut_perf", i, args))
end
return table.concat(ret) .. "\n|-\n"
end
function forms.ind_comp_fut(args, conj, family)
local inf_vowels = { = "ā", = "ē", = "e", = "ī", = "ī"}
local ret = {'! class="roa-indicative-left-rail" | future\n'}
for i, v in ipairs(aux.ind_comp_fut) do
table.insert(ret, "\n| " .. show_forms(v .. args .. get_forms(inf_vowels, conj) .. "re", family, "ind_comp_fut", i, args))
end
return table.concat(ret) .. "\n|-\n"
end
forms.sub_pres = {
= {"em", "ēs", "et", "ēmus", "ētis", "ent"},
= {"am", "ās", "at", "āmus", "ātis", "ant"},
= {"am", "ās", "at", "āmus", "ātis", "ant"},
= {"iam", "iās", "iat", "iāmus", "iātis", "iant"},
= {"ēscam", "ēscās", "ēscat", "iāmus", "iātis", "ēscant"},
= {"iam", "iās", "iat", "iāmus", "iātis", "iant"},
}
setmetatable(forms.sub_pres, {__call = loop_over, __tostring = function() return {"present", "sub_pres"} end})
forms.sub_imperf = {
= {"ārem", "ārēs", "āret", "ārēmus", "ārētis", "ārent"},
= {"ērem", "ērēs", "ēret", "ērēmus", "ērētis", "ērent"},
= {"erem", "erēs", "eret", "erēmus", "erētis", "erent"},
= {"īrem", "īrēs", "īret", "īrēmus", "īrētis", "īrent"}
}
setmetatable(forms.sub_imperf, {__call = loop_over, __tostring = function() return {"imperfect", "sub_imperf"} end})
forms.sub_pluperf = {
= {"āssem", "āssēs", "āsset", "āssēmus", "āssētis", "āssent"},
= {"issem", "issēs", "isset", "issēmus", "issētis", "issent"},
= {"issem", "issēs", "isset", "issēmus", "issētis", "issent"},
= {"īssem", "īssēs", "īsset", "īssēmus", "īssētis", "īssent"}
}
setmetatable(forms.sub_pluperf, {__call = loop_over_perf, __tostring = function() return {"pluperfect", "sub_pluperf"} end})
forms.imp = {
= {"—", "ā", "—", "—", "āte", "—"},
= {"—", "e", "—", "—", "ete", "—"},
= {"—", "e", "—", "—", "ite", "—"},
= {"—", "ī", "—", "—", "īte", "—"},
= {"—", "ēsce", "—", "—", "īte", "—"}
}
setmetatable(forms.imp, {__call = loop_over, __tostring = function() return {"present", "imp"} end})
forms.categories = {
= {"first"},
= {"second"},
= {"third"},
= {"fourth"},
}
setmetatable(forms.categories, {__call = function(self, args, conj, family)
return " .. " conjugation verbs]]"
end
})
local function make_table(args, conj, family)
local tb = {}
for i, v in ipairs(forms_to_use) do
table.insert(tb, forms(args, conj, family))
end
local tb_string = table.concat(tb)
tb_string = mw.ustring.gsub(tb_string, "{{{family}}}", long_family_names)
tb_string = mw.ustring.gsub(tb_string, "{{{inf}}}", args .. get_forms(forms.ind_pres, conj))
return require("Module:TemplateStyles")("Module:roa-verb/style.css") .. tb_string
end
function export.show(frame)
if mw.title.getCurrentTitle().nsText == "Template" then return end
local parent_args = frame:getParent().args
local conj = frame.args or parent_args or "1st"
if not parent_args then
parent_args = "am"
end
local ret = ""
if parent_args then
ret = make_table(parent_args, conj, parent_args)
if parent_args then
ret = ret .. make_table(parent_args, conj, parent_args)
end
else
ret = make_table(parent_args, conj, "It-W") .. make_table(parent_args, conj, "E") .. make_table(parent_args, conj, "S")
end
return ret
end
return export