বিষয়বস্তুতে চলুন

মডিউল:vo-conj

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:vo-conj/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

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 m_gn = require("Module:gender and number")
    local sg = m_gn.format_genders({"s"})
    local pl = m_gn.format_genders({"p"})

    local t = {{"", "pa"}, {"e", "pe"}, {"ä", "pä"}, {"i", "pi"}, {"o", "po"}, {"u", "pu"}, {"ö", "pö"}, {"ü", "pü"}}
    local p = {
    	{"1st " .. sg, "ob"}, {"2nd " .. sg, "ol"}, {"2nd " .. sg .. " polite", "or"},
    	{"3rd " .. sg, "on"}, {"3rd " .. sg .. " male", "om"}, {"3rd " .. sg .. " female", "of"},
    	{"reflexive " .. sg, "ok"}, {"reciprocative " .. sg, "od"},
    	{"1st " .. pl, "obs"}, {"2nd " .. pl, "ols"}, {"2nd " .. pl .. " polite", "ors"},
    	{"3rd " .. pl, "ons"}, {"3rd " .. pl .. " male", "oms"}, {"3rd " .. pl .. " female", "ofs"},
    	{"reflexive " .. pl, "oks"}, {"reciprocative " .. pl, "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 = {mw.getCurrentFrame():expandTemplate{
    	title = 'inflection-table-top',
    	args = {
    		title = '[[Appendix:Volapük verbs|Conjugation]] of <i><span lang="vo">' .. root .. 'ön</span></i>',
	    	palette = 'magenta',
	    	tall = 'yes',
	    	class = 'wide',
    	}
    }}

    local function verbs(voice)
        table.insert(val, "\n|-\n!colspan=2 style=\"background-color: var(--wikt-palette-brightyellow)\" " ..
        	"class=\"outer\"|" .. f[8][voice])
        table.insert(val, "\n|colspan=3|" .. link(t[1][voice], "ön"))
        table.insert(val, "\n|colspan=999 class=\"blank-end-row\"|")
        table.insert(val, "\n|-\n|colspan=999 class=\"separator\"|")

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

            for j = 1, 18, 1 do
                table.insert(val, "\n|-\n!colspan=2|" .. p[j][1])
                for k = 1, 8, 1 do
                    table.insert(val, "\n|colspan=2|" .. link(t[k][voice], p[j][2] .. f[i][3]))
                end
            end
            
        	table.insert(val, "\n|-\n|colspan=999 class=\"separator\"|")
        end

        table.insert(val, "\n|-\n!class=\"outer\" style=\"background-color: var(--wikt-palette-brightyellow)\" colspan=2|")
        table.insert(val, "\n!class=\"outer\" style=\"background-color: var(--wikt-palette-brightyellow)\" " ..
        	"colspan=3|" .. f[6][voice])
        table.insert(val, "\n!class=\"outer\" style=\"background-color: var(--wikt-palette-brightyellow)\" " ..
        	"colspan=3|" .. f[7][voice])
        table.insert(val, "\n|colspan=999 rowspan=19 class=\"blank-end-row\"|")
        for j = 1, 18, 1 do
            table.insert(val, "\n|-\n! colspan=2|" .. p[j][1])
            table.insert(val, "\n|colspan=3|" .. link(t[1][voice], p[j][2] .. "öv"))
            table.insert(val, "\n|colspan=3|" .. link(t[1][voice], p[j][2] .. "öd"))
        end
    end

    verbs(1)

    if intr ~= "yes" then
    	table.insert(val, "\n|-\n|colspan=999 class=\"separator\"|")
        verbs(2)
    end

	table.insert(val, "\n" .. mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom '})

    return table.concat(val)
end


return p