Module:vo-conj

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local lang = require("Module:languages").getByCode("vo")

local p = {}

function p.init(frame)
    local intr = frame:getParent().args["intr"]
    local pagename = tostring( mw.title:getCurrentTitle() )
    local root = mw.ustring.sub(pagename, 0, -3)
    return p.conj(root, intr)
end

function p.conj(root, intr)
    local function link(prefix, suffix)
        return require("Module:links").full_link({lang = lang, accel = {form = prefix .. suffix}, term = prefix .. root .. suffix})
    end

    local function row(r)
        return ""
    end

    local t = {{"", "pa"}, {"e", "pe"}, {"ä", "pä"}, {"i", "pi"}, {"o", "po"}, {"u", "pu"}, {"ö", "pö"}, {"ü", "pü"}}
    local p = {{"1st person singular", "ob"}, {"2nd person singular", "ol"}, {"2nd person polite singular", "or"}, {"3rd person singular", "on"}, {"3rd person male singular", "om"}, {"3rd person female singular", "of"}, {"reflexive singular", "ok"}, {"reciprocative singular", "od"}, {"1st person plural", "obs"}, {"2nd person plural", "ols"}, {"2nd person polite plural", "ors"}, {"3rd person plural", "ons"}, {"3rd person male plural", "oms"}, {"3rd person female plural", "ofs"}, {"reflexive plural", "oks"}, {"reciprocative plural", "ods"}, {"indefinite", "oy"}, {"impersonal", "os"}}
    local f = {{"Active indicative", "Passive indicative", ""}, {"Active subjunctive", "Passive subjunctive", "-la"}, {"Active optative", "Passive optative", "ös"}, {"Active interrogative", "Passive interrogative", "-li"}, {"Active jussive", "Passive jussive", "öz"}, {"Active conditional", "Passive conditional", nil}, {"Active imperative", "Passive imperative", nil}, {"Active infinitive", "Passive infinitive", nil}}

    local val = {[=[<div class="NavFrame">
<div class="NavHead" style="background-color:#FFE6FF;">[[Appendix:Volapük verbs|Conjugation]] of <span lang="vo">]=] .. root .. [=[ön</span></div>
<div class="NavContent" style="overflow:auto">
{| border="1" cellpadding="5" style="border-bottom:2; border-collapse:collapse" width=100% class="inflection-table" align="center"]=]}

    local function verbs(voice)
        table.insert(val, "\n|-\n!style=\"background-color:#FFF55F\" colspan=18|" .. f[8][voice])
        table.insert(val, "\n|-\n|style=\"background-color:#F0F0F0\" colspan=18|" .. link(t[1][voice], "ön"))

        for i = 1, 5, 1 do
            table.insert(val, "\n|-\n!style=\"background-color:#FFF55F\" colspan=2|" .. f[i][voice])
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|present")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|present perfect")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|imperfect")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|pluperfect")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|future")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|future perfect")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|future in the past")
            table.insert(val, "\n!style=\"background-color:#C6C\" colspan=2|future in the past perfect")

            for j = 1, 18, 1 do
                table.insert(val, "\n|-\n!style=\"background-color:#C6C\" colspan=2|" .. p[j][1])
                for k = 1, 8, 1 do
                    table.insert(val, "\n|style=\"background-color:#F0F0F0\" colspan=2|" .. link(t[k][voice], p[j][2] .. f[i][3]))
                end
            end
        end

        table.insert(val, "\n|-\n!style=\"background-color:#FFF55F\" colspan=18|" .. f[6][voice])
        for j = 1, 18, 1 do
            table.insert(val, "\n|-\n!style=\"background-color:#C6C\" colspan=2|" .. p[j][1])
            table.insert(val, "\n|style=\"background-color:#F0F0F0\" colspan=16|" .. link(t[1][voice], p[j][2] .. "öv"))
        end

        table.insert(val, "\n|-\n!style=\"background-color:#FFF55F\" colspan=18|" .. f[7][voice])
        for j = 1, 18, 1 do
            table.insert(val, "\n|-\n!style=\"background-color:#C6C\" colspan=2|" .. p[j][1])
            table.insert(val, "\n|style=\"background-color:#F0F0F0\" colspan=16|" .. link(t[1][voice], p[j][2] .. "öd"))
        end
    end

    verbs(1)

    if intr ~= "yes" then
        verbs(2)
    end

table.insert(val, [=[

|}
</div></div>]=])

    return table.concat(val)
end


return p