Mòdul:eo-conj

De Viccionari
Icona de documentació de mòdul Documentació del mòdul[mostra] [modifica] [refresca]

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


Mòdul de suport per la plantilla {{eo-conj}}. Vegeu la documentació de la plantilla per a més informació.

local p = {}

local lang = {code = "eo", name = "esperanto", sc = "Latn"}

function p.init(frame)
	local intr = frame:getParent().args["intr"]
	local root = frame:getParent().args["arrel"]
	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:enllaç").full_link({lang = lang, term = root .. affix})
	end
	
	local function row(r)
		return ""
	end
	
	local t = {"a", "i", "o"}
	
	local val = [=[{| class="eo-conj-wrapper"
|-
|  ||<div class="NavFrame">
<div class="NavHead">Conjugació de <span lang="eo">]=] .. root .. 'i' .. (intr == nil and '' or ' (intransitiu)') .. [=[</span></div>
<div class="NavContent">
{| class="inflection-table eo-conj"
|-
|rowspan=2 colspan=2|[[File:Esperanto star.svg|30px|link=|alt=]]
! colspan=2|present 
! colspan=2|passat 
! colspan=2|futur
|-
! 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("indicatiu", "s")
	for i = 1, 8, 1 do
		if ( i - 1 ) % 4 < 2 or intr == nil 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! <span title=\"acusatiu\">acus.</span>"
			else
				val = val .. "\n|-\n! rowspan=2| participi "
				if act == "" then val = val .. "passiu" else val = val .. "actiu" end
				if i < 5 then
					val = val .. " adjectival"
				else
					val = val .. " nominal"
				end

				val = val .. "\n!"
			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("participi actiu adverbial", "nte")
	if intr == nil then threecells("participi passiu adverbial", "te") end
	
val = val .. [=[ 
|}
{| class="inflection-table eo-conj eo-conj-bottom"
|-
!colspan="2" | infinitiu
|colspan="6" | <span lang="eo">''']=] .. root .. [=[i'''</span>
!colspan="2" | volitiu
|colspan="6" | ]=] .. link("u") .. [=[ 
!colspan="2" | condicional
|colspan="6" | ]=] .. link("us") .. [=[ 
|}
</div></div>
|}]=]
	
	-- check some red links
	if not (mw.title.new(root .. 'anta').exists and mw.title.new(root .. 'anto').exists and mw.title.new(root .. 'ante').exists) then
		val = val .. "[[Categoria:Termes en esperanto amb flexions a crear]]"
	end
	
	-- Module:TemplateStyles
	return mw.getCurrentFrame():extensionTag{
		name = "templatestyles", args = { src = "Module:eo-conj/style.css" }
	} .. "\n" .. val

end


return p