Module:eo-conj

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:eo-conj/documentation. [edit]
Useful links: subpage listtransclusionstestcases
Text-x-generic with pencil.svg This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local p = {}
 
function p.init(frame)
    local intr = frame:getParent().args["intr"]
    local pagename = tostring( mw.title:getCurrentTitle() )
    local root = string.sub(pagename, 0, -2)
    return p.conj(root, intr)
end
 
function p.conj(root, intr)
    local function link(affix)
        return "<span lang=\"eo\">[[" .. root .. affix .. "#Esperanto|" .. root .. affix .. "]]</span>"
    end
 
    local function row(r)
        return ""
    end
 
    local t = {"a", "i", "o"}
 
    local val = [=[{| width="100%"
|-
|  ||<div class="NavFrame">
<div class="NavHead" style="background:#e2f6e2;">Conjugation of <span lang="eo">]=] .. root .. [=[i</span></div>
<div class="NavContent">
{| border="1" cellpadding="5" style="border-bottom:2; border-collapse:collapse" width=100% class="inflection-table" align="center"
|-
|rowspan=2 colspan=2|[[Image:Esperanto star.svg|30px]]
!bgcolor="#B0E0B0" colspan=2|present 
!bgcolor="#B0E0B0" colspan=2|past 
!bgcolor="#B0E0B0" colspan=2|future
|-
|bgcolor="#B0E0B0"|singular
|bgcolor="#B0E0B0"|plural
|bgcolor="#B0E0B0"|singular
|bgcolor="#B0E0B0"|plural
|bgcolor="#B0E0B0"|singular
|bgcolor="#B0E0B0"|plural]=]
    local function threecells(preword, affix)
        val = val .. "\n|-\n!bgcolor=\"#B0E0B0\" colspan=2| " .. preword
        for i = 1, 3, 1 do
            val = val .. "\n|bgcolor=\"#F0F0F0\" colspan=2|" .. link(t[i] .. affix)
        end
    end
    threecells("tense", "s")
    for i = 1, 8, 1 do
        if ( i - 1 ) % 4 < 2 or intr ~= "yes" then
            local act = ( i - 1 ) % 4 > 1 and "" or "n"
            local nom = i > 4 and "o" or "a"
            local acc = ""
            if i % 2 == 0 then
                acc = "n"
                val = val .. "\n|-\n|bgcolor=\"#B0E0B0\"| <span title=\"accusative\">acc.</span>"
            else
                val = val .. "\n|-\n!bgcolor=\"#B0E0B0\" rowspan=2| "
                if i > 4 then val = val .. "nominal " end
                if act == "" then val = val .. "passive" else val = val .. "active" end
 
                val = val .. " participle\n!bgcolor=\"#B0E0B0\"|"
            end
 
            for ii = 1, 6, 1 do
                val = val .. "\n|bgcolor=\"#F0F0F0\"|" .. link( t[ math.ceil( ii / 2 ) ] .. act .. "t" .. nom .. (ii % 2 == 0 and "j" or "") .. acc )
            end
        end
    end
    threecells("adverbial active participle", "nte")
    if intr ~= "yes" then threecells("adverbial passive participle", "te") end
 
val = val .. [=[ 
|}
{| width=100% border=1 style="border-collapse:collapse" class="inflection-table"
|-
!bgcolor="#B0E0B0" colspan=2 width=16.66%| infinitive
|colspan="6" bgcolor="#F0F0F0" width=16.66%| <span lang="eo">''']=] .. root .. [=[i'''</span>
!bgcolor="#B0E0B0" colspan=2 width=16.66%| imperative 
|colspan="6" bgcolor="#F0F0F0" width=16.66%| ]=] .. link("u") .. [=[ 
!bgcolor="#B0E0B0" colspan=2 width=16.66%| conditional
|colspan="6" bgcolor="#F0F0F0" width=16.66%| ]=] .. link("us") .. [=[ 
|}
</div></div>
|}]=]
 
    return val
end
 
 
return p