Mòdul:ca-verb/taula
La documentació d'ús d'aquest mòdul es pot crear a Mòdul:ca-verb/taula/ús
-- Make the table
local p = {}
local function formesDefectives(tipus)
local defectius = {}
if tipus == "36" then
defectius = require("Mòdul:utilitats").llista({1, 2, 4, 5, "m-p", "f-s", "f-p", "imp"})
elseif tipus == "3" then
defectius = require("Mòdul:utilitats").llista({1, 2, 4, 5, 6, "m-p", "f-s", "f-p", "imp"})
elseif tipus == "part" then
defectius = require("Mòdul:utilitats").llista({1, 2, 3, 4, 5, 6, "ger", "imp"})
end
return defectius
end
-- Formes del paradigma: present d'indicatiu 1, 3, 4
local function paradigma(forma, defectius, pp, pp_el)
local paradigma = {}
paradigma[1] = forma["pres-ind"][1][1]
paradigma[2] = forma["pres-ind"][1][3]
paradigma[3] = forma["pres-ind"][1][4]
if paradigma[1] and paradigma[2] and paradigma[3] then
if not defectius[1] then
paradigma[1] = (paradigma[1]:find("^[aeiouh]") and pp_el[1] or pp[1]) .. '[[' .. paradigma[1] .. ']]'
end
if not defectius[3] then
paradigma[2] = (paradigma[2]:find("^[aeiouh]") and pp_el[3] or pp[3]) .. '[[' .. paradigma[2] .. ']]'
end
if not defectius[4] then
paradigma[3] = (paradigma[3]:find("^[aeiouh]") and pp_el[4] or pp[4]) .. '[[' .. paradigma[3] .. ']]'
end
return "Paradigmes de flexió: " .. table.concat(paradigma, ", ")
end
return ''
end
local function rizo(vocal)
if vocal == nil then return '' end
local text = "<br />Vocal rizotònica: "
if vocal == "é" then
return text .. "/e/"
elseif vocal == "è" then
return text .. "/ɛ/"
elseif vocal == "ê" then
return text .. "/ɛ/, /ə/, /e/"
elseif vocal == "ë" then
return text .. "/ɛ/, /e/"
elseif vocal == "ó" then
return text .. "/o/"
elseif vocal == "ò" then
return text .. "/ɔ/"
elseif vocal == "ô" then
return text .. "/ɔ/, /o/"
else
return text .. vocal
end
end
local function makeRowsGer(forma, part, vpron)
local ret = '| colspan="3" | ' .. (forma.ger[1] and (forma.ger[1][1] or "-") or "-") .. [=[
| colspan="4" | havent]=] .. vpron .. " " .. (part or "-") .. [=[
|-
]=]
if forma.ger[2] then
ret = ret .. '| colspan="6" | ' .. forma.ger[2][1].. [=[
| class="conj-notes" | ]=] .. (forma.ger[2]["nota"] or "") .. [=[
|-
]=]
end
return ret
end
local function makeRowsPart(forma)
local ret = ""
if #forma.part > 0 then
for i, v in ipairs(forma.part) do
ret = ret .. '| colspan="6" | ' .. forma.part[i]["m-s"]
if forma.part[i]["f-s"] then
ret = ret .. ", " .. forma.part[i]["f-s"] .. ", " .. (forma.part[i]["m-p"] or "-") .. ", " .. (forma.part[i]["f-p"] or "-")
end
ret = ret .. [=[
| class="conj-notes" | ]=] .. (forma.part[i]["nota"] or "") .. [=[
|-
]=]
end
else
ret = '| colspan="7" | -' .. [=[
|-
]=]
end
return ret
end
local function makeRows6(forma, temps)
local ret = ""
if #forma[temps] > 0 then
for i, v in ipairs(forma[temps]) do
local rowstyle = '| '
if i == 1 and string.sub(temps, 1, 4) ~= "pres" then
rowstyle = '| style="border-top: 1px solid grey" | '
end
for j = 1, 6 do
ret = ret .. rowstyle .. (forma[temps][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma[temps][i]["nota"] or "") .. [=[
|-
]=]
end
else
for j = 1, 6 do
ret = ret .. '| style="border: 1px solid grey" | -' .. [=[
]=]
end
ret = ret .. [=[
|-
]=]
end
return ret
end
local function makeRowsImp(forma)
local ret = ""
if #forma.imp > 0 then
for i, v in ipairs(forma.imp) do
ret = ret .. '| –' .. [=[
]=]
for j = 2, 6 do
ret = ret .. '| ' .. (forma.imp[i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma.imp[i]["nota"] or "") .. [=[
|-
]=]
end
else
ret = ret .. '| –' .. [=[
]=]
for j = 2, 6 do
ret = ret .. '| -' .. [=[
]=]
end
ret = ret .. [=[
|-
]=]
end
return ret
end
local function makeSimples(forma, part, title, vpron)
return [=[
<div class="NavFrame nav-frame">
<div class="NavHead nav-head"><span class="conj-headTitle">]=] .. title .. [=[</span></div>
<div class="NavContent nav-content">
{| class="conjugacions"
! colspan="7" class="conj-headerPersForms" | Formes no personals
! class="conj-notes" | [[Viccionari:Conjugació|Notes]]
|-
! class="conj-tensNotPers" |
! colspan="3" class="conj-tensNotPers" | simples
! colspan="3" class="conj-tensNotPers" | compostes
|-
! class="conj-tensNotPers" | infinitiu
| colspan="3" | [[]=] .. forma.inf .. "]]" .. (vpron == "-se" and (forma.inf:find("[aeiou]$") and "'s" or "-se") or vpron) .. [=[
| colspan="3" | haver]=] .. vpron .. " " .. (part or "-") .. [=[
|-
! rowspan="]=] .. (#forma.ger > 0 and #forma.ger or "1") .. [=[" class="conj-tensNotPers" | gerundi
]=] .. makeRowsGer(forma, part, vpron) .. [=[
! rowspan="]=] .. (#forma.part > 0 and #forma.part or "1") .. [=[" class="conj-tensNotPers" | participi
]=] .. makeRowsPart(forma) .. [=[
! colspan="7" class="conj-headerPersForms notheme" | Formes personals simples
|-
! class="conj-headerIndicative" | indicatiu
! class="conj-headerIndicative" | jo
! class="conj-headerIndicative" | tu
! class="conj-headerIndicative" | ell/ella/vostè
! class="conj-headerIndicative" | nosaltres
! class="conj-headerIndicative" | vosaltres/vós
! class="conj-headerIndicative" | ells/elles/vostès
|-
! rowspan="]=] .. (#forma["pres-ind"] > 0 and #forma["pres-ind"] or "1") .. [=[" class="conj-tensIndicative" | present
]=] .. makeRows6(forma, "pres-ind") .. [=[
! rowspan="]=] .. (#forma["imperf-ind"] > 0 and #forma["imperf-ind"] or "1") .. [=[" class="conj-tensIndicative" | imperfet
]=] .. makeRows6(forma, "imperf-ind") .. [=[
! rowspan="]=] .. (#forma.pass > 0 and #forma.pass or "1") .. [=[" class="conj-tensIndicative" | passat simple
]=] .. makeRows6(forma, "pass") .. [=[
! rowspan="]=] .. (#forma.fut > 0 and #forma.fut or "1") .. [=[" class="conj-tensIndicative" | futur
]=] .. makeRows6(forma, "fut") .. [=[
! rowspan="]=] .. (#forma.cond > 0 and #forma.cond or "1") .. [=[" class="conj-tensIndicative" | condicional
]=] .. makeRows6(forma, "cond") .. [=[
! class="conj-headerSubjunctive" | subjuntiu
! class="conj-headerSubjunctive" | jo
! class="conj-headerSubjunctive" | tu
! class="conj-headerSubjunctive" | ell/ella/vostè
! class="conj-headerSubjunctive" | nosaltres
! class="conj-headerSubjunctive" | vosaltres/vós
! class="conj-headerSubjunctive" | ells/elles/vostès
|-
! rowspan="]=] .. (#forma["pres-subj"] > 0 and #forma["pres-subj"] or "1") .. [=[" class="conj-tensSubjunctive" | present
]=] .. makeRows6(forma, "pres-subj") .. [=[
! rowspan="]=] .. (#forma["imperf-subj"] > 0 and #forma["imperf-subj"] or "1") .. [=[" class="conj-tensSubjunctive" | imperfet
]=] .. makeRows6(forma, "imperf-subj") .. [=[
! class="conj-headerImperative" | imperatiu
! class="conj-headerImperative" | –
! class="conj-headerImperative" | tu
! class="conj-headerImperative" | ell/ella/vostè
! class="conj-headerImperative" | nosaltres
! class="conj-headerImperative" | vosaltres/vós
! class="conj-headerImperative" | ells/elles/vostès
|-
! rowspan="]=] .. (#forma.imp > 0 and #forma.imp or "1") .. [=[" class="conj-tensImperative" | present
]=] .. makeRowsImp(forma) .. [=[
|-
| colspan="8" class="conj-footnote" | ]=] .. (forma.nota or "") .. [=[
|}
</div></div>]=]
end
local function makeRowsGerPartNo(forma)
local ret = ""
if forma["no-ger"] then
ret = ret .. [=[! class="conj-tensNotPers" | gerundi
| colspan="6" | ]=] .. forma["no-ger"] .. [=[
|-
]=]
end
if forma["no-part"] then
ret = ret .. [=[! class="conj-tensNotPers" | participi
| colspan="6" | ]=] .. forma["no-part"]["m-s"] .. ", " .. forma["no-part"]["f-s"] .. ", " .. forma["no-part"]["m-p"].. ", " .. forma["no-part"]["f-p"]
ret = ret .. [=[
| class="conj-notes" | ]=] .. (forma["no-part"]["nota"] or "") .. [=[
|-
]=]
end
return ret
end
local function makeRowsPresNo(forma)
local ret = ""
if forma["no-pres-ind"] then
ret = ret .. '! rowspan="' .. #forma["no-pres-ind"] .. [=[" class="conj-tensIndicative" | present
]=]
for i, v in ipairs(forma["no-pres-ind"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-pres-ind"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-pres-ind"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsImperfindNo(forma)
local ret = ""
if forma["no-imperf-ind"] then
ret = ret .. '! rowspan="' .. #forma["no-imperf-ind"] .. [=[" class="conj-tensIndicative" | imperfet
]=]
for i, v in ipairs(forma["no-imperf-ind"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-imperf-ind"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-imperf-ind"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsPassNo(forma)
local ret = ""
if forma["no-pass"] then
ret = ret .. '! rowspan="' .. #forma["no-pass"] .. [=[" class="conj-tensIndicative" | passat simple
]=]
for i, v in ipairs(forma["no-pass"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-pass"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-pass"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsFutNo(forma)
local ret = ""
if forma["no-fut"] then
ret = ret .. '! rowspan="' .. #forma["no-fut"] .. [=[" class="conj-tensIndicative" | futur
]=]
for i, v in ipairs(forma["no-fut"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-fut"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-fut"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsCondNo(forma)
local ret = ""
if forma["no-cond"] then
ret = ret .. '! rowspan="' .. #forma["no-cond"] .. [=[" class="conj-tensIndicative" | condicional
]=]
for i, v in ipairs(forma["no-cond"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-cond"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-cond"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsPresssubjNo(forma)
local ret = ""
if forma["no-pres-subj"] then
ret = ret .. '! rowspan="' .. #forma["no-pres-subj"] .. [=[" class="conj-tensSubjunctive" | present
]=]
for i, v in ipairs(forma["no-pres-subj"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-pres-subj"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-pres-subj"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsImperfsubjNo(forma)
local ret = ""
if forma["no-imperf-subj"] then
ret = ret .. '! rowspan="' .. #forma["no-imperf-subj"] .. [=[" class="conj-tensSubjunctive" | imperfet
]=]
for i, v in ipairs(forma["no-imperf-subj"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-imperf-subj"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-imperf-subj"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeRowsImpNo(forma)
local ret = ""
if forma["no-imp"] then
ret = ret .. [=[! class="conj-headerImperative" | imperatiu
! class="conj-headerImperative" | -
! class="conj-headerImperative" | tu
! class="conj-headerImperative" | ell/ella/vostè
! class="conj-headerImperative" | nosaltres
! class="conj-headerImperative" | vosaltres/vós
! class="conj-headerImperative" | ells/elles/vostès
|-
! rowspan="]=] .. #forma["no-imp"] .. [=[" class="conj-tensImperative" | present
]=]
for i, v in ipairs(forma["no-imp"]) do
for j = 1, 6 do
ret = ret .. '| ' .. (forma["no-imp"][i][j] or "") .. [=[
]=]
end
ret = ret .. '| class="conj-notes" | ' .. (forma["no-imp"][i]["nota"] or "") .. [=[
|-
]=]
end
end
return ret
end
local function makeAlternatives(forma)
if not (forma["no-ger"] or forma["no-part"] or forma["no-pres-ind"] or forma["no-imperf-ind"] or forma["no-fut"] or forma["no-cond"]
or forma["no-pres-subj"] or forma["no-imperf-subj"] or forma["no-imp"]) then
return ""
end
return [=[
<div class="NavFrame nav-frame">
<div class="NavHead nav-head"><span class="conj-headTitle2">Formes no normatives o col·loquials</span></div>
<div class="NavContent nav-content">
{| class="conjugacions"
]=] .. makeRowsGerPartNo(forma) .. [=[
! class="conj-headerIndicative" | indicatiu
! class="conj-headerIndicative" | jo
! class="conj-headerIndicative" | tu
! class="conj-headerIndicative" | ell/ella/vostè
! class="conj-headerIndicative" | nosaltres
! class="conj-headerIndicative" | vosaltres/vós
! class="conj-headerIndicative" | ells/elles/vostès
|-
]=] .. makeRowsPresNo(forma) .. [=[
]=] .. makeRowsImperfindNo(forma) .. [=[
]=] .. makeRowsPassNo(forma) .. [=[
]=] .. makeRowsFutNo(forma) .. [=[
]=] .. makeRowsCondNo(forma) .. [=[
! class="conj-headerSubjunctive" | subjuntiu
! class="conj-headerSubjunctive" | jo
! class="conj-headerSubjunctive" | tu
! class="conj-headerSubjunctive" | ell/ella/vostè
! class="conj-headerSubjunctive" | nosaltres
! class="conj-headerSubjunctive" | vosaltres/vós
! class="conj-headerSubjunctive" | ells/elles/vostès
|-
]=] .. makeRowsPresssubjNo(forma) .. [=[
]=] .. makeRowsImperfsubjNo(forma) .. [=[
]=] .. makeRowsImpNo(forma) .. [=[
|}
</div></div>]=]
end
local function makeRowsComp(pers, pp, def)
local ret = ""
for j = 1, 6 do
if def[j] then
ret = ret .. '| -' .. [=[
]=]
else
ret = ret .. '| ' .. (pers[j] and (pp[j] .. pers[j]) or "") .. [=[
]=]
end
end
return ret
end
local function makeCompostes(inf, part, pp_pro_ref, pp_pro_el, pp_pro_el_c, def)
if not part then
return ""
end
return [=[
<div class="NavFrame nav-frame">
<div class="NavHead nav-head"><span class="conj-headTitle2">Formes compostes i perifràstiques</span></div>
<div class="NavContent nav-content">
{| class="conjugacions"
! class="conj-headerIndicative" | indicatiu
! class="conj-headerIndicative" | jo
! class="conj-headerIndicative" | tu
! class="conj-headerIndicative" | ell/ella/vostè
! class="conj-headerIndicative" | nosaltres
! class="conj-headerIndicative" | vosaltres/vós
! class="conj-headerIndicative" | ells/elles/vostès
! class="conj-headerIndicative" | verb
|-
! rowspan="2" class="conj-tensIndicative" | perfet
]=] .. makeRowsComp({"he", "has", "ha", "hem", "heu", "han"}, pp_pro_el_c, def) .. [=[
| rowspan="2" | ... ]=] .. part .. [=[
|-
]=] .. makeRowsComp({nil, nil, nil, "havem", "haveu", nil}, pp_pro_el_c, def) .. [=[
|-
! rowspan="2" class="conj-tensIndicative" | passat perifràstic
]=] .. makeRowsComp({"vaig", "vas", "va", "vam", "vau", "van"}, pp_pro_ref, def) .. [=[
| rowspan="2" | ... ]=] .. inf .. [=[
|-
]=] .. makeRowsComp({nil, "vares", nil, "vàrem", "vàreu", "varen"}, pp_pro_ref, def) .. [=[
|-
! class="conj-tensIndicative" | plusquamperfet
]=] .. makeRowsComp({"havia", "havies", "havia", "havíem", "havíeu", "havien"}, pp_pro_el_c, def) .. [=[
| ... ]=] .. part .. [=[
|-
! rowspan="3" class="conj-tensIndicative" | passat anterior<br />o perifràstic
]=] .. makeRowsComp({"haguí", "hagueres", "hagué", "haguérem", "haguéreu", "hagueren"}, pp_pro_el_c, def) .. [=[
| rowspan="3" | ... ]=] .. part .. [=[
|-
]=] .. makeRowsComp({"vaig haver", "vas haver", "va haver", "vam haver", "vau haver", "van haver"}, pp_pro_ref, def) .. [=[
|-
]=] .. makeRowsComp({nil, "vares haver", nil, "vàrem haver", "vàreu haver", "varen haver"}, pp_pro_ref, def) .. [=[
|-
! class="conj-tensIndicative" | futur perfet
]=] .. makeRowsComp({"hauré", "hauràs", "haurà", "haurem", "haureu", "hauran"}, pp_pro_el_c, def) .. [=[
| ... ]=] .. part .. [=[
|-
! rowspan="2" class="conj-tensIndicative" | condicional perfet
]=] .. makeRowsComp({"hauria", "hauries", "hauria", "hauríem", "hauríeu", "haurien"}, pp_pro_el_c, def) .. [=[
| rowspan="2" | ... ]=] .. part .. [=[
|-
]=] .. makeRowsComp({"haguera", "hagueres", "haguera", "haguérem", "haguéreu", "hagueren"}, pp_pro_el_c, def) .. [=[
|-
! class="conj-headerSubjunctive" | subjuntiu
! class="conj-headerSubjunctive" | jo
! class="conj-headerSubjunctive" | tu
! class="conj-headerSubjunctive" | ell/ella/vostè
! class="conj-headerSubjunctive" | nosaltres
! class="conj-headerSubjunctive" | vosaltres/vós
! class="conj-headerSubjunctive" | ells/elles/vostès
! class="conj-headerSubjunctive" | verb
|-
! rowspan="2" class="conj-tensSubjunctive" | passat perifràstic
]=] .. makeRowsComp({"vagi", "vagis", "vagi", "vàgim", "vàgiu", "vagin"}, pp_pro_ref, def) .. [=[
| rowspan="2" | ... ]=] .. inf .. [=[
|-
]=] .. makeRowsComp({"vaja", "vages", "vaja", "vàgem", "vàgeu", "vagen"}, pp_pro_ref, def) .. [=[
|-
! rowspan="2" class="conj-tensSubjunctive" | perfet
]=] .. makeRowsComp({"hagi", "hagis", "hagi", "hàgim", "hàgiu", "hagin"}, pp_pro_el_c, def) .. [=[
| rowspan="2" | ... ]=] .. part .. [=[
|-
]=] .. makeRowsComp({"haja", "hages", "haja", "hàgem", "hàgeu", "hagen"}, pp_pro_el_c, def) .. [=[
|-
! rowspan="3" class="conj-tensSubjunctive" | plusquamperfet
]=] .. makeRowsComp({"hagués", "haguessis", "hagués", "haguéssim", "haguéssiu", "haguessin"}, pp_pro_el_c, def) .. [=[
| rowspan="3" | ... ]=] .. part .. [=[
|-
]=] .. makeRowsComp({nil, "haguesses", nil, "haguéssem", "haguésseu", "haguessen"}, pp_pro_el_c, def) .. [=[
|-
]=] .. makeRowsComp({"haguera", "hagueres", "haguera", "haguérem", "haguéreu", "hagueren"}, pp_pro_el_c, def) .. [=[
|-
! rowspan="2" class="conj-tensSubjunctive" | passat anterior<br />perifràstic
]=] .. makeRowsComp({"vagi haver", "vagis haver", "vagi haver", "vàgim haver", "vàgiu haver", "vagin haver"}, pp_pro_ref, def) .. [=[
| rowspan="2" | ... ]=] .. part .. [=[
|-
]=] .. makeRowsComp({"vaja haver", "vages haver", "vaja haver", "vàgem haver", "vàgeu haver", "vagen haver"}, pp_pro_ref, def) .. [=[
|}
</div></div>]=]
end
-- This generates machine-readable output, which allows formbots to easily
-- parse the output of the module.
function p.make_bot_list(forma, def)
local defectius = formesDefectives(def)
local ret = ""
for key1, form1 in pairs(forma) do
if type(form1) == "table" then
for key2, form2 in pairs(form1) do
if type(form2) == "table" then
for key3, form3 in pairs(form2) do
if key3 ~= "nota" and not (defectius[key3] or defectius[key1]) then
ret = ret .. "* " .. key1 .. "-" .. key3 .. "=" .. form3 .. "(" .. (form2.nota or "") .. ")\n"
end
end
elseif key2 ~= "nota" and not (defectius[key2] or defectius[key1]) then
ret = ret .. "* " .. key1 .. "-" .. key2 .. "=" .. form2 .. "(" .. (form1.nota or "") .. ")\n"
end
end
elseif key1 ~= "nota" and not defectius[key1] then
ret = ret .. "* " .. key1 .. "=" .. form1 .. "()\n"
end
end
return ret
end
local function templateStyles()
local frame = mw.getCurrentFrame()
return frame:extensionTag{
name = 'templatestyles', args = {src = 'navbar/styles.css'}
} .. frame:extensionTag{
name = 'templatestyles', args = {src = 'Module:ca-verb/styles.css'}
}
end
function p.make_table(forma, title, tipus_def)
local defectius = formesDefectives(tipus_def)
if #defectius > 0 then
title = title .. ", defectiva"
end
-- Pronoms
local pp_pro_ref = {'', '', '', '', '', ''}
local pp_pro_el = {'', '', '', '', '', ''}
local pp_pro_el_c = {'', '', '', '', '', ''}
local pp_enc_ple = {'', '', '', '', '', ''}
local pp_enc_red = {'', '', '', '', '', ''}
local vpron = ''
if pagename:find("[-']") then
vpron = mw.ustring.gsub(pagename, ".-[-']", "", 1)
end
if vpron == "se" or vpron == "s" then
vpron = "-se"
pp_pro_ref = {"em ", "et ", "es ", "ens ", "us ", "es "}
if forma.inf:find("^s") then
pp_pro_ref[3] = "se "
pp_pro_ref[6] = "se "
end
pp_pro_el = {"m'", "t'", "s'", "ens ", "us ", "s'"}
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-me", "-te", "-se", "-nos", "-vos", "-se"}
pp_enc_red = {"'m", "'t", "'s", "'ns", "-us", "'s"}
elseif vpron == "se'n" then
vpron = "-se'n"
pp_pro_ref = {"me'n ", "te'n ", "se'n ", "ens en ", "us en ", "se'n "}
pp_pro_el = {"me n'", "te n'", "se n'", "ens n'", "us n'", "se n'"}
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-me'n", "-te'n", "-se'n", "-nos-en", "-vos-en", "-se'n"}
pp_enc_red = {"-me'n", "-te'n", "-se'n", "'ns-en", "-us-en", "-se'n"}
elseif vpron == "se-la" then
vpron = "-se-la"
pp_pro_ref = {"me la ", "te la ", "se la ", "ens la ", "us la ", "se la "}
pp_pro_el_c = {"me l'", "te l'", "se l'", "ens l'", "us l'", "se l'"}
if forma.inf:find("^h?[aeo]") then
pp_pro_el = pp_pro_el_c
else
pp_pro_el = pp_pro_ref
end
pp_enc_ple = {"-me-la", "-te-la", "-se-la", "-nos-la", "-vos-la", "-se-la"}
pp_enc_red = {"-me-la", "-te-la", "-se-la", "'ns-la", "-us-la", "-se-la"}
elseif vpron == "se-les" then
vpron = "-se-les"
pp_pro_ref = {"me les ", "te les ", "se les ", "ens les ", "us les ", "se les "}
pp_pro_el = pp_pro_ref
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-me-les", "-te-les", "-se-les", "-nos-les", "-vos-les", "-se-les"}
pp_enc_red = {"-me-les", "-te-les", "-se-les", "'ns-les", "-us-les", "-se-les"}
elseif vpron == "s'hi" then
vpron = "-s'hi"
pp_pro_ref = {"m'hi ", "t'hi ", "s'hi ", "ens hi ", "us hi ", "s'hi "}
pp_pro_el = pp_pro_ref
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-m'hi", "-t'hi", "-s'hi", "-nos-hi", "-vos-hi", "-s'hi"}
pp_enc_red = {"-m'hi", "-t'hi", "-s'hi", "'ns-hi", "-us-hi", "-s'hi"}
elseif vpron == "ne" then
vpron = "-ne"
pp_pro_ref = {"en ", "en ", "en ", "en ", "en ", "en "}
pp_pro_el = {"n'", "n'", "n'", "n'", "n'", "n'"}
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-ne", "-ne", "-ne", "-ne", "-ne", "-ne"}
pp_enc_red = {"'n", "'n", "'n", "'n", "'n", "'n"}
elseif vpron == "hi" then
vpron = "-hi"
pp_pro_ref = {"hi ", "hi ", "hi ", "hi ", "hi ", "hi "}
pp_pro_el = pp_pro_ref
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-hi", "-hi", "-hi", "-hi", "-hi", "-hi"}
pp_enc_red = pp_enc_ple
elseif vpron == "la" then
vpron = "-la"
pp_pro_ref = {"la ", "la ", "la ", "la ", "la ", "la "}
pp_pro_el_c = {"l'", "l'", "l'", "l'", "l'", "l'"}
if forma.inf:find("^h?[aeo]") then
pp_pro_el = pp_pro_el_c
else
pp_pro_el = pp_pro_ref
end
pp_enc_ple = {"-la", "-la", "-la", "-la", "-la", "-la"}
pp_enc_red = pp_enc_ple
elseif vpron == "les" then
vpron = "-les"
pp_pro_ref = {"les ", "les ", "les ", "les ", "les ", "les "}
pp_pro_el = pp_pro_ref
pp_pro_el_c = pp_pro_el
pp_enc_ple = {"-les", "-les", "-les", "-les", "-les", "-les"}
pp_enc_red = pp_enc_ple
end
local paradigmes = paradigma(forma, defectius, pp_pro_ref, pp_pro_el)
-- Make links out of all forms
for key1, form1 in pairs(forma) do
if type(form1) == "table" then
for key2, form2 in pairs(form1) do
if type(form2) == "table" then
for key3, form3 in pairs(form2) do
if key3 ~= "nota" and form3 ~= '-' then
if key1 == "ger" or key1 == "no-ger" then
if defectius[key1] then
forma[key1][key2][key3] = "<span class=\"conj-notlinked\">" .. form3 .. pp_enc_ple[3] .. "</span>"
else
forma[key1][key2][key3] = "[[" .. form3 .. "]]" .. pp_enc_ple[3]
end
elseif key1 == "imp" or key1 == "no-imp" then
if defectius[key3] or defectius[key1] then
forma[key1][key2][key3] = "<span class=\"conj-notlinked\">" .. form3 .. (form3:find("[aeio]$") and pp_enc_red[key3] or pp_enc_ple[key3]) .. "</span>"
else
forma[key1][key2][key3] = "[[" .. form3 .. "]]" .. (form3:find("[aeio]$") and pp_enc_red[key3] or pp_enc_ple[key3])
end
elseif key1 == "part" or key1 == "no-part" then
if defectius[key3] or defectius[key1] then
forma[key1][key2][key3] = "<span class=\"conj-notlinked\">" .. form3 .. "</span>"
else
forma[key1][key2][key3] = "[[" .. form3 .. "]]"
end
else
if defectius[key3] or defectius[key1] then
forma[key1][key2][key3] = "<span class=\"conj-notlinked\">" .. (form3:find("^[aeiouh]") and pp_pro_el[key3] or pp_pro_ref[key3]) .. form3 .. "</span>"
else
forma[key1][key2][key3] = (form3:find("^[aeiouh]") and pp_pro_el[key3] or pp_pro_ref[key3]) .. "[[" .. form3 .. "]]"
end
end
end
end
elseif key2 ~= "nota" and form2 ~= '-' then
if defectius[key2] or defectius[key1] then
forma[key1][key2] = "<span class=\"conj-notlinked\">" .. form2 .. "</span>"
else
forma[key1][key2] = "[[" .. form2 .. "]]"
end
end
end
elseif key1 == "no-ger" and form1 ~= '-' then
if defectius[key1] then
forma[key1] = "<span class=\"conj-notlinked\">" .. form1 .. pp_enc_ple[3] .. "</span>"
else
forma[key1] = "[[" .. form1 .. "]]" .. pp_enc_ple[3]
end
end
end
local part = forma.part[1] and forma.part[1]["m-s"] or nil
if #forma.part > 1 then
if forma.part[2]["m-s"] ~= "[[nat]]" then
part = part .. " o " .. forma.part[2]["m-s"]
end
end
return templateStyles() ..
makeSimples(forma, part, title, vpron) ..
makeAlternatives(forma) ..
makeCompostes(forma.inf, part, pp_pro_ref, pp_pro_el, pp_pro_el_c, defectius) ..
paradigmes ..
rizo(forma.rizo)
end
return p