Mòdul:roa-oca-verb
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 {{roa-oca-conj}} per a generar la taula de conjugació antiga d’un verb en català antic. Vegeu la plantilla per al seu ús.
Les taules es construeixen a base de verbs model definits en subpàgines d’aquest mòdul. Models disponibles:
- roa-oca-verb/atendre
- roa-oca-verb/cantar
- roa-oca-verb/cobrir
- roa-oca-verb/dar
- roa-oca-verb/dir
- roa-oca-verb/donar
- roa-oca-verb/entendre
- roa-oca-verb/esser
- roa-oca-verb/fer
- roa-oca-verb/partir
- roa-oca-verb/poder
- roa-oca-verb/prendre
- roa-oca-verb/riure
- roa-oca-verb/seure
- roa-oca-verb/valer
- roa-oca-verb/voler
- roa-oca-verb/ús
Addicionalment, amb el paràmetre bot=1
, o qualsevol valor, genera una llista per a facilitar la lectura per un bot.
Usa els estils definits a Plantilla:navbar/styles.css i Mòdul:ca-verb/styles.css.
local p = {}
local m_navbar = require('Module:navbar')
local lang = {code = "roa-oca", name = "català antic", sc = "Latn"}
-- This generates machine-readable output, which allows formbots to easily
-- parse the output of the module.
local function make_bot_list(forma)
local ret = ""
for key1, form1 in pairs(forma) do --temps
for key2, form2 in pairs(form1) do -- fila
for key3, form3 in pairs(form2) do -- persona
ret = ret .. "* " .. key1 .. "-" .. key3 .. "=" .. form3 .. "\n"
end
end
end
return ret
end
local function make_rows_ger(forma)
local ret = ""
if #forma.ger > 0 then
for i, v in ipairs(forma.ger) do
ret = ret .. '| colspan="6" | ' .. forma.ger[i][1] .. [=[
|-
]=]
end
else
ret = '| colspan="6" | -' .. [=[
|-
]=]
end
return ret
end
local function make_rows_part(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 .. [=[
|-
]=]
end
else
ret = '| colspan="6" | -' .. [=[
|-
]=]
end
return ret
end
local function make_rows_6(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 (i == 1 and "–" or "")) .. [=[
]=]
end
ret = ret .. [=[
|-
]=]
end
else
for j = 1, 6 do
ret = ret .. '| style="border: 1px solid grey" | -' .. [=[
]=]
end
ret = ret .. [=[
|-
]=]
end
return ret
end
local function make_rows_imp(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 .. [=[
|-
]=]
end
else
ret = ret .. '| –' .. [=[
]=]
for j = 2, 6 do
ret = ret .. '| -' .. [=[
]=]
end
ret = ret .. [=[
|-
]=]
end
return ret
end
local function make_table(forma, infinitiu)
-- Make links out of all forms
for key1, form1 in pairs(forma) do -- temps
for key2, form2 in pairs(form1) do -- fila
for key3, form3 in pairs(form2) do -- persona
forma[key1][key2][key3] = require("Mòdul:enllaç").full_link({lang = lang, term = form3})
end
end
end
local title = "Conjugació antiga"
return m_navbar._open({title=title}) .. [=[
{| class="conjugacions"
! colspan="7" class="conj-headerPersForms" | Formes no personals
|-
! class="conj-tensNotPers" | infinitiu
| colspan="6" | [[]=] .. infinitiu .. "]]" .. [=[
|-
! rowspan="]=] .. (#forma.ger > 0 and #forma.ger or "1") .. [=[" class="conj-tensNotPers" | gerundi
]=] .. make_rows_ger(forma) .. [=[
! rowspan="]=] .. (#forma.part > 0 and #forma.part or "1") .. [=[" class="conj-tensNotPers" | participi
]=] .. make_rows_part(forma) .. [=[
! colspan="7" class="conj-headerPersForms" | Formes personals simples
|-
! class="conj-headerIndicative" | indicatiu
! class="conj-headerIndicative" | io, yo, jo
! class="conj-headerIndicative" | tu
! class="conj-headerIndicative" | él, eyl, ell
! class="conj-headerIndicative" | nós, nosaltres
! class="conj-headerIndicative" | vós, vosaltres
! class="conj-headerIndicative" | éls, eyls, ells
|-
! rowspan="]=] .. (#forma["pres-ind"] > 0 and #forma["pres-ind"] or "1") .. [=[" class="conj-tensIndicative" | present
]=] .. make_rows_6(forma, "pres-ind") .. [=[
! rowspan="]=] .. (#forma["imperf-ind"] > 0 and #forma["imperf-ind"] or "1") .. [=[" class="conj-tensIndicative" | imperfet
]=] .. make_rows_6(forma, "imperf-ind") .. [=[
! rowspan="]=] .. (#forma.pass > 0 and #forma.pass or "1") .. [=[" class="conj-tensIndicative" | passat simple
]=] .. make_rows_6(forma, "pass") .. [=[
! rowspan="]=] .. (#forma.fut > 0 and #forma.fut or "1") .. [=[" class="conj-tensIndicative" | futur
]=] .. make_rows_6(forma, "fut") .. [=[
! rowspan="]=] .. (#forma.cond > 0 and #forma.cond or "1") .. [=[" class="conj-tensIndicative" | condicional
]=] .. make_rows_6(forma, "cond") .. [=[
! class="conj-headerSubjunctive" | subjuntiu
! class="conj-headerSubjunctive" | io, yo, jo
! class="conj-headerSubjunctive" | tu
! class="conj-headerSubjunctive" | él, eyl, ell
! class="conj-headerSubjunctive" | nós, nosaltres
! class="conj-headerSubjunctive" | vós, vosaltres
! class="conj-headerSubjunctive" | éls, eyls, ells
|-
! rowspan="]=] .. (#forma["pres-subj"] > 0 and #forma["pres-subj"] or "1") .. [=[" class="conj-tensSubjunctive" | present
]=] .. make_rows_6(forma, "pres-subj") .. [=[
! rowspan="]=] .. (#forma["imperf-subj"] > 0 and #forma["imperf-subj"] or "1") .. [=[" class="conj-tensSubjunctive" | imperfet
]=] .. make_rows_6(forma, "imperf-subj") .. [=[
! class="conj-headerImperative" | imperatiu
! class="conj-headerImperative" | –
! class="conj-headerImperative" | tu
! class="conj-headerImperative" | él, eyl, ell
! class="conj-headerImperative" | nós, nosaltres
! class="conj-headerImperative" | vós, vosaltres
! class="conj-headerImperative" | éls, eyls, ells
|-
! rowspan="]=] .. (#forma.imp > 0 and #forma.imp or "1") .. [=[" class="conj-headerImperative" | present
]=] .. make_rows_imp(forma) .. [=[
|}
]=] .. m_navbar._close()
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.show(frame)
local args = frame:getParent().args
local pagename = args.pagename or mw.title.getCurrentTitle().subpageText
local NAMESPACE = mw.title.getCurrentTitle().nsText
local infinitiu = args.inf or pagename
local model = args[1] or ""
if model == "" then return end
local forma = require("Module:roa-oca-verb/" .. model).formes(infinitiu)
if args.bot then
return make_bot_list(forma)
else
return templateStyles() .. make_table(forma, infinitiu)
end
end
return p