Module:lld-conj
Appearance
- The following documentation is located at Module:lld-conj/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local m_links = require("Module:links")
local m_utilities = require("Module:utilities")
local m_infl = require("Module:lld-conj/data")
local lang = require("Module:languages").getByCode("lld")
local export = {}
-- Shows forms with links, or a dash if empty
local function show_form(subforms)
if not subforms then
return "—"
elseif type(subforms) ~= "table" then
error("a non-table value was given in the list of inflected forms.")
elseif #subforms == 0 then
return "—"
end
local ret = {}
-- Go over each subform and insert links
for key, subform in ipairs(subforms) do
table.insert(ret, m_links.full_link({lang = lang, term = subform}))
end
return table.concat(ret, ", ")
end
-- Shows the table with the given forms
local function make_table(data)
local ret = {require("Module:TemplateStyles")("Module:roa-verb/style.css") .. "\n"}
table.insert(ret, [=[* Ladin conjugation varies from one region to another. Hence, the following conjugation should be considered as typical, not as exhaustive.
<div class="NavFrame">
<div class="NavHead">Conjugation of ]=])
table.insert(ret, m_links.full_link({lang = lang, alt = mw.title.getCurrentTitle().text}, "term") .. " (" .. data.conj .. ")</div>\n")
table.insert(ret, [=[<div class="NavContent">
{| class="roa-inflection-table"
|-
! colspan="1" class="roa-nonfinite-header" | infinitive
| colspan="2" | ]=])
table.insert(ret, show_form(data.forms.inf) .. "\n")
table.insert(ret, [=[
|-
! colspan="1" class="roa-nonfinite-header" | auxiliary verb
| colspan="2" | ]=])
table.insert(ret, show_form(data.forms.aux) .. "\n")
table.insert(ret, [=[
! colspan="2" class="roa-nonfinite-header" | gerund
| colspan="2" | ]=])
table.insert(ret, show_form(data.forms.gerund) .. "\n")
table.insert(ret, [=[
|-
! colspan="1" class="roa-nonfinite-header" | past participle
| colspan="2" | ]=])
table.insert(ret, show_form(data.forms.past_part) .. "\n")
table.insert(ret, [=[
|-
! colspan="1" rowspan="2" class="roa-person-number-header" | person
! colspan="3" class="roa-person-number-header" | singular
! colspan="3" class="roa-person-number-header" | plural
|-
! class="roa-person-number-header" style="width:12.5%;" | first
! class="roa-person-number-header" style="width:12.5%;" | second
! class="roa-person-number-header" style="width:12.5%;" | third
! class="roa-person-number-header" style="width:12.5%;" | first
! class="roa-person-number-header" style="width:12.5%;" | second
! class="roa-person-number-header" style="width:12.5%;" | third
|-
! class="roa-indicative-left-rail" colspan="1" | indicative
! class="roa-indicative-left-rail" | ie
! class="roa-indicative-left-rail" | tu
! class="roa-indicative-left-rail" | el / ela
! class="roa-indicative-left-rail" | nos
! class="roa-indicative-left-rail" | vos
! class="roa-indicative-left-rail" | ei / eles
|-
! style="height:3em" class="roa-indicative-left-rail" colspan="1" | present
]=])
table.insert(ret, "| " .. show_form(data.forms.pres_ind_1sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_ind_2sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_ind_3sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_ind_1pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_ind_2pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_ind_3pl) .. "\n")
table.insert(ret, [=[
|-
! style="height:3em" class="roa-indicative-left-rail" colspan="1" | imperfect
]=])
table.insert(ret, "| " .. show_form(data.forms.impf_ind_1sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_ind_2sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_ind_3sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_ind_1pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_ind_2pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_ind_3pl) .. "\n")
table.insert(ret, [=[
|-
! style="height:3em" class="roa-indicative-left-rail" colspan="1" | future
]=])
table.insert(ret, "| " .. show_form(data.forms.futr_ind_1sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.futr_ind_2sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.futr_ind_3sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.futr_ind_1pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.futr_ind_2pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.futr_ind_3pl) .. "\n")
table.insert(ret, [=[
|-
! class="roa-subjunctive-left-rail" colspan="1" | subjunctive
! class="roa-subjunctive-left-rail" | che ie
! class="roa-subjunctive-left-rail" | che tu
! class="roa-subjunctive-left-rail" | che el / ela
! class="roa-subjunctive-left-rail" | che nos
! class="roa-subjunctive-left-rail" | che vos
! class="roa-subjunctive-left-rail" | che ei / eles
|-
! style="height:3em" class="roa-subjunctive-left-rail" colspan="1" | present
]=])
table.insert(ret, "| " .. show_form(data.forms.pres_sub_1sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_sub_2sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_sub_3sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_sub_1pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_sub_2pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.pres_sub_3pl) .. "\n")
table.insert(ret, [=[
|-
! style="height:3em" class="roa-subjunctive-left-rail" colspan="1" | imperfect
]=])
table.insert(ret, "| " .. show_form(data.forms.impf_sub_1sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_sub_2sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_sub_3sg) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_sub_1pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_sub_2pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impf_sub_3pl) .. "\n")
table.insert(ret, [=[
|-
! colspan="1" rowspan="2" style="height:3em" class="roa-imperative-left-rail" | imperative
! class="roa-imperative-left-rail" | –
! class="roa-imperative-left-rail" | tu
! class="roa-imperative-left-rail" | –
! class="roa-imperative-left-rail" | nos
! class="roa-imperative-left-rail" | vos
! class="roa-imperative-left-rail" | –
|-
| —
]=])
table.insert(ret, "| " .. show_form(data.forms.impr_2sg) .. "\n")
table.insert(ret, "| —\n")
table.insert(ret, "| " .. show_form(data.forms.impr_1pl) .. "\n")
table.insert(ret, "| " .. show_form(data.forms.impr_2pl) .. "\n")
table.insert(ret, "| —\n")
table.insert(ret, [=[
|}
</div></div>]=])
return table.concat(ret)
end
-- Main entry point
function export.show(frame)
local args = mw.clone(frame:getParent().args)
-- Create the forms
local data = {forms = {}, categories = {}}
if mw.title.getCurrentTitle().nsText ~= "" then return end
local word = mw.title.getCurrentTitle().text
if m_infl[word] then
args[1] = m_infl[word].get_stem(word)
m_infl[word](args, data)
elseif mw.ustring.sub(word, -2, -1) == "ir" then
args[1] = m_infl["ir"].get_stem(word)
m_infl["ir"](args, data)
else
local conj = frame.args["conj"]
if m_infl[conj] then
m_infl[conj](args, data)
else
error("Inflection for " .. word .. " not found.")
end
end
return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end
return export