Called by {{VL-adj-1&2}}
and {{VL-adj-3rd}}
. Do not use directly.
local m_links = require("Module:links")
local m_utilities = require("Module:utilities")
local m_vl_translit = require("Module:VL-translit")
local lang = require("Module:languages").getByCode("la")
local export = {}
local branch_links = {
= "]",
= "]",
= "]",
}
local decl_names = {
= "First/second declension",
= "Third declension",
= "Irregular, but similar to first and second declensions"
}
local decls = {}
decls = {}
setmetatable(decls, {__call = function(self, args, data)
data.forms = {args .. "us"}
data.forms = {args .. "ī"}
data.forms = {args .. "ī"}
data.forms = {args .. "ōrum"}
data.forms = {args .. "ō"}
data.forms = {args .. "īs"}
data.forms = {args .. "um"}
data.forms = {args .. "ōs"}
data.forms = {args .. "a"}
data.forms = {args .. "ae"}
data.forms = {args .. "ae"}
data.forms = {args .. "ārum"}
data.forms = {args .. "ae"}
data.forms = {args .. "īs"}
data.forms = {args .. "am"}
data.forms = {args .. "ās"}
data.forms = {args .. "u"}
data.forms = {args .. "a"}
data.forms = {args .. "ī"}
data.forms = {args .. "ōrum"}
data.forms = {args .. "ō"}
data.forms = {args .. "īs"}
data.forms = {args .. "um"}
data.forms = {args .. "a"}
table.insert(data.categories, "Latin first and second declension adjectives")
end
})
decls = {}
setmetatable(decls, {__call = function(self, args, data)
data.forms = {args .. "is"}
data.forms = {args .. "ēs"}
data.forms = {args .. "is"}
data.forms = {args .. "ium"}
data.forms = {args .. "ī"}
data.forms = {args .. "ibus"}
data.forms = {args .. "em"}
data.forms = {args .. "es"}
data.forms = {args .. "is"}
data.forms = {args .. "ēs"}
data.forms = {args .. "is"}
data.forms = {args .. "ium"}
data.forms = {args .. "ī"}
data.forms = {args .. "ibus"}
data.forms = {args .. "em"}
data.forms = {args .. "es"}
data.forms = {args .. "e"}
data.forms = {args .. "ia"}
data.forms = {args .. "is"}
data.forms = {args .. "ium"}
data.forms = {args .. "ī"}
data.forms = {args .. "ibus"}
data.forms = {args .. "em"}
data.forms = {args .. "ia"}
table.insert(data.categories, "Latin third declension adjectives")
end
})
decls = {}
setmetatable(decls, {__call = function(self, args, data)
data.forms = {"accum ille", "accum illī"}
data.forms = {"accum illī"}
data.forms = {"accum illūius"}
data.forms = {"accum illōrum"}
data.forms = {"accum illī", "accum illūi"}
data.forms = {"accum illīs", "accum illōrum"}
data.forms = {"accum illum"}
data.forms = {"accum illōs"}
data.forms = {"accum illa"}
data.forms = {"accum illae"}
data.forms = {"accum illaeius"}
data.forms = {"accum illōrum"}
data.forms = {"accum illī", "accum illae", "accum illaei"}
data.forms = {"accum illīs"}
data.forms = {"accum illam"}
data.forms = {"accum illās"}
data.forms = {"accum illum"}
data.forms = {"accum illa"}
data.forms = {}
data.forms = {"accum illōrum"}
data.forms = {}
data.forms = {"accum illīs"}
data.forms = {"accum illum"}
data.forms = {"accum illa"}
end
})
local cases = {
= {short_form = "nom", link = "'']''"},
= {short_form = "acc-abl", link = "'']-]''"},
= {short_form = "gen", link = "'']''"},
= {short_form = "dat", link = "'']''"},
}
local function make_headers(data, wikicode)
table.insert(wikicode, '|- class="vsHide"\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. '; font-style:italic;" | Number\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. '; font-style:italic;" colspan="3" | Singular\n')
table.insert(wikicode, '|rowspan="2" |\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. '; font-style:italic;" colspan="3" | Plural\n')
table.insert(wikicode, '|- class="vsHide"\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. '; font-style:italic;"| Case / Gender\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';"| Masculine\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';"| Feminine\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';"| Neuter\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';"| Masculine\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';"| Feminine\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';"| Neuter\n')
end
local function show_forms(forms, data, branch)
local function show_single_form(form, data, branch)
local function convert_word(form, branch)
if mw.ustring.find(form, "{{{") then
return form
else
return m_vl_translit.convert_words(form, branch)
end
end
if not form then
return "—"
end
return m_links.full_link({lang = lang, alt = convert_word(form, branch), term = "*" .. form})
end
local form_t = {}
for i, form in ipairs(forms) do
table.insert(form_t, show_single_form(form, data, branch))
end
return table.concat(form_t, ", ")
end
local function make_case(data, wikicode, case, branch)
local case_short = cases.short_form
table.insert(wikicode, '|- class="vsHide"\n')
table.insert(wikicode, '! style="background:#' .. data.latincolour .. ';" | ' .. cases.link .. '\n')
table.insert(wikicode, '| style="background:#' .. data.latincolour .. ';" | ' .. show_forms(data.forms, data, branch) .. '\n')
table.insert(wikicode, '| style="background:#' .. data.latincolour .. ';" | ' .. show_forms(data.forms, data, branch) .. '\n')
table.insert(wikicode, '| style="background:#' .. data.latincolour .. ';" | ' .. show_forms(data.forms, data, branch) .. '\n')
if case_short == "nom" then table.insert(wikicode, '|rowspan="4"|\n') end
table.insert(wikicode, '| style="background:#' .. data.latincolour .. ';" | ' .. show_forms(data.forms, data, branch) .. '\n')
table.insert(wikicode, '| style="background:#' .. data.latincolour .. ';" | ' .. show_forms(data.forms, data, branch) .. '\n')
table.insert(wikicode, '| style="background:#' .. data.latincolour .. ';" | ' .. show_forms(data.forms, data, branch) .. '\n')
end
local function make_table(data, branch)
local wikicode = {'{| class="prettytable inflection-table vsSwitcher" data-toggle-category="inflection"\n'}
table.insert(wikicode, '! colspan="8" class="vsToggleElement" style="text-align:left;min-width: 25em;background:#' ..
data.latincolour .. '" | ')
table.insert(wikicode, branch_links .. ' declension of #head\n')
make_headers(data, wikicode)
make_case(data, wikicode, "nominative", branch)
make_case(data, wikicode, "genitive", branch)
make_case(data, wikicode, "dative", branch)
make_case(data, wikicode, "accusative-ablative", branch)
table.insert(wikicode, "|}")
return table.concat(wikicode)
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local args = require("Module:parameters").process(frame:getParent().args, {
= true,
= true,
= true,
= true,
= true,
})
local decl_type = (args or frame.args) or "1&2"
if not decls then
error("Unknown declension type '" .. decl_type .. "'")
end
local data = {forms = {}, categories = {}}
data.head = args or nil
data.latincolour = {
frame:expandTemplate({title = "Latincolour1"}),
frame:expandTemplate({title = "Latincolour2"}),
frame:expandTemplate({title = "Latincolour3"}),
}
if mw.title.getCurrentTitle().nsText == "Template" then
setmetatable(args, {__index = function(self, key)
return "{{{" .. key .. "}}}"
end
})
end
-- Generate the forms
decls(args, data)
data = decl_type
-- Make the table
t = decl_names .. '.\n\n'
if args.family then
t = t .. make_table(data, args.family)
if args.family2 then
t = t .. "\n" .. make_table(data, args.family2)
end
else
t = t .. make_table(data, "It-W") .. "\n" .. make_table(data, "E") .. "\n" .. make_table(data, "S")
end
t = mw.ustring.gsub(t, "#head", m_links.full_link({lang = lang, alt = "*" .. data.forms}, "term"))
return t .. m_utilities.format_categories(data.categories, lang)
end
return export