Module:eo-conj
Appearance
- The following documentation is located at Module:eo-conj/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local lang = require("Module:languages").getByCode("eo")
local p = {}
function p.init(frame)
local intr = frame:getParent().args["intr"]
local root = frame:getParent().args["root"]
if not root then
local pagename = tostring( mw.title:getCurrentTitle() )
root = string.sub(pagename, 0, -2)
end
return p.conj(root, intr)
end
function p.conj(root, intr)
local function link(affix)
return require("Module:links").full_link({lang = lang, accel = {form = affix}, term = root .. affix})
end
local function row(r)
return ""
end
local t = {"a", "i", "o"}
local val = mw.getCurrentFrame():expandTemplate{
title = 'inflection-table-top',
args = {
title = 'Conjugation of <span lang="eo">' .. root .. 'i</span>',
palette = 'green',
tall = 'yes',
}
} .. [=[
|rowspan=2 colspan=2|[[Image:Esperanto star.svg|30px|link=|alt=]]
! colspan=2 class="outer" |present
! colspan=2 class="outer" |past
! colspan=2 class="outer" |future
|-
! singular
! plural
! singular
! plural
! singular
! plural]=]
local function threecells(preword, affix)
val = val .. "\n|-\n! colspan=2| " .. preword
for i = 1, 3, 1 do
val = val .. "\n| 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! class="secondary" | <span title="accusative">acc.</span>'
else
val = val .. "\n|-\n! 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! class="secondary" |'
end
for ii = 1, 6, 1 do
val = val .. "\n| " .. 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 .. [=[
|-
| colspan="999" class="separator" |
|-
! colspan="2" |
! infinitive
| <span lang="eo">''']=] .. root .. [=[i'''</span>
! imperative
| ]=] .. link("u") .. [=[
! conditional
| ]=] .. link("us") .. '\n' .. mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom' } .. '</div>'
return val
end
return p