De Muysc cubun - Lengua Muisca
m |
m |
||
| Línea 5: | Línea 5: | ||
local function cleanPageName(pageName) | local function cleanPageName(pageName) | ||
pageName = mw.text.trim(pageName or "") | pageName = mw.text.trim(pageName or "") | ||
| − | pageName = mw.ustring.gsub(pageName, "%s*%b()", "") | + | pageName = mw.ustring.gsub(pageName, "%s*%b()", "") -- quita (2), (3), etc. |
return pageName | return pageName | ||
end | end | ||
| − | -- | + | -- Obtiene la raíz: |
| + | -- sq. => quita -squa | ||
| + | -- su. => quita -suca | ||
| + | -- si hay |raiz= manual, lo usa | ||
local function getRoot(pageName, clase, manualRoot) | local function getRoot(pageName, clase, manualRoot) | ||
manualRoot = mw.text.trim(manualRoot or "") | manualRoot = mw.text.trim(manualRoot or "") | ||
| Línea 28: | Línea 31: | ||
end | end | ||
| − | -- | + | -- Construye las bases TAM |
| − | local function buildPerfective(root | + | local function buildPerfective(root) |
| − | + | return root | |
| − | + | end | |
| − | + | ||
| − | + | local function buildImperfective(root) | |
| − | + | return root .. "-squa" | |
| − | |||
| − | |||
end | end | ||
| − | |||
local function buildIrrealis(root) | local function buildIrrealis(root) | ||
| − | return root .. "nga" | + | return root .. "-nga" |
end | end | ||
| Línea 47: | Línea 47: | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
| − | -- Parámetros | + | -- Parámetros |
local clase = mw.text.trim(args.clase or "") -- sq. / su. | local clase = mw.text.trim(args.clase or "") -- sq. / su. | ||
local trans = mw.text.trim(args.trans or "") -- intr. / tr. (opcional) | local trans = mw.text.trim(args.trans or "") -- intr. / tr. (opcional) | ||
| Línea 67: | Línea 67: | ||
} | } | ||
| − | local perfectiveBase = buildPerfective(root | + | local perfectiveBase = buildPerfective(root) |
| + | local imperfectiveBase = buildImperfective(root) | ||
local irrealisBase = buildIrrealis(root) | local irrealisBase = buildIrrealis(root) | ||
| Línea 79: | Línea 80: | ||
header:tag("th"):wikitext("Persona") | header:tag("th"):wikitext("Persona") | ||
header:tag("th"):wikitext("Perfectivo") | header:tag("th"):wikitext("Perfectivo") | ||
| + | header:tag("th"):wikitext("Imperfectivo") | ||
header:tag("th"):wikitext("Irrealis") | header:tag("th"):wikitext("Irrealis") | ||
| Línea 89: | Línea 91: | ||
row:tag("td"):wikitext(label) | row:tag("td"):wikitext(label) | ||
row:tag("td"):wikitext(prefix .. perfectiveBase) | row:tag("td"):wikitext(prefix .. perfectiveBase) | ||
| + | row:tag("td"):wikitext(prefix .. imperfectiveBase) | ||
row:tag("td"):wikitext(prefix .. irrealisBase) | row:tag("td"):wikitext(prefix .. irrealisBase) | ||
end | end | ||
| Línea 94: | Línea 97: | ||
local output = "" | local output = "" | ||
output = output .. string.format("<div><b>Página:</b> %s</div>", pageName) | output = output .. string.format("<div><b>Página:</b> %s</div>", pageName) | ||
| − | output = output .. string.format("<div><b>Clase:</b> %s %s</div>", clase, trans) | + | output = output .. string.format("<div><b>Clase léxica:</b> %s %s</div>", clase, trans) |
output = output .. string.format("<div><b>Raíz detectada:</b> %s</div>", root) | output = output .. string.format("<div><b>Raíz detectada:</b> %s</div>", root) | ||
| − | output = output .. | + | output = output .. "<div><b>Hipótesis TAM:</b> perfectivo Ø · imperfectivo -squa · irrealis -nga</div>" |
output = output .. tostring(html) | output = output .. tostring(html) | ||
Revisión del 20:17 24 mar 2026
La documentación para este módulo puede ser creada en Módulo:Conjugador/doc
local p = {}
-- Limpia el nombre de la página:
-- quita espacios y sufijos tipo (2), (3), etc.
local function cleanPageName(pageName)
pageName = mw.text.trim(pageName or "")
pageName = mw.ustring.gsub(pageName, "%s*%b()", "") -- quita (2), (3), etc.
return pageName
end
-- Obtiene la raíz:
-- sq. => quita -squa
-- su. => quita -suca
-- si hay |raiz= manual, lo usa
local function getRoot(pageName, clase, manualRoot)
manualRoot = mw.text.trim(manualRoot or "")
if manualRoot ~= "" then
return manualRoot
end
local root = cleanPageName(pageName)
clase = mw.text.trim(clase or "")
if clase == "sq." then
root = mw.ustring.gsub(root, "squa$", "")
elseif clase == "su." then
root = mw.ustring.gsub(root, "suca$", "")
end
return root
end
-- Construye las bases TAM
local function buildPerfective(root)
return root
end
local function buildImperfective(root)
return root .. "-squa"
end
local function buildIrrealis(root)
return root .. "-nga"
end
function p.render(frame)
local args = frame:getParent().args
-- Parámetros
local clase = mw.text.trim(args.clase or "") -- sq. / su.
local trans = mw.text.trim(args.trans or "") -- intr. / tr. (opcional)
local manualRoot = mw.text.trim(args.raiz or "")
local pageName = mw.title.getCurrentTitle().text
local root = getRoot(pageName, clase, manualRoot)
if root == "" then
return "<span style='color:red;'>Error: no se pudo identificar la raíz.</span>"
end
local persons = {
{"1sg", "z-"},
{"2sg", "m-"},
{"3", "a-"},
{"1pl", "chi-"},
{"2pl", "mi-"}
}
local perfectiveBase = buildPerfective(root)
local imperfectiveBase = buildImperfective(root)
local irrealisBase = buildIrrealis(root)
local html = mw.html.create("table")
:addClass("wikitable")
:css("width", "auto")
:css("text-align", "left")
-- Cabecera
local header = html:tag("tr")
header:tag("th"):wikitext("Persona")
header:tag("th"):wikitext("Perfectivo")
header:tag("th"):wikitext("Imperfectivo")
header:tag("th"):wikitext("Irrealis")
-- Filas
for _, personData in ipairs(persons) do
local label = personData[1]
local prefix = personData[2]
local row = html:tag("tr")
row:tag("td"):wikitext(label)
row:tag("td"):wikitext(prefix .. perfectiveBase)
row:tag("td"):wikitext(prefix .. imperfectiveBase)
row:tag("td"):wikitext(prefix .. irrealisBase)
end
local output = ""
output = output .. string.format("<div><b>Página:</b> %s</div>", pageName)
output = output .. string.format("<div><b>Clase léxica:</b> %s %s</div>", clase, trans)
output = output .. string.format("<div><b>Raíz detectada:</b> %s</div>", root)
output = output .. "<div><b>Hipótesis TAM:</b> perfectivo Ø · imperfectivo -squa · irrealis -nga</div>"
output = output .. tostring(html)
return output
end
return p
