De Muysc cubun - Lengua Muisca
m |
m |
||
| Línea 2: | Línea 2: | ||
-- Limpia el nombre de la página: | -- Limpia el nombre de la página: | ||
| − | -- | + | -- quita espacios y sufijos tipo (2), (3), etc. |
| − | |||
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()", "") |
return pageName | return pageName | ||
end | end | ||
| − | -- | + | -- Detecta la raíz automáticamente según la clase |
| − | local function getRoot(pageName, clase) | + | local function getRoot(pageName, clase, manualRoot) |
| + | manualRoot = mw.text.trim(manualRoot or "") | ||
| + | if manualRoot ~= "" then | ||
| + | return manualRoot | ||
| + | end | ||
| + | |||
local root = cleanPageName(pageName) | local root = cleanPageName(pageName) | ||
| − | |||
clase = mw.text.trim(clase or "") | clase = mw.text.trim(clase or "") | ||
if clase == "sq." then | if clase == "sq." then | ||
| − | |||
root = mw.ustring.gsub(root, "squa$", "") | root = mw.ustring.gsub(root, "squa$", "") | ||
elseif clase == "su." then | elseif clase == "su." then | ||
| − | |||
root = mw.ustring.gsub(root, "suca$", "") | root = mw.ustring.gsub(root, "suca$", "") | ||
end | end | ||
return root | return root | ||
| + | end | ||
| + | |||
| + | -- Forma perfectiva (no marcada): usa la terminación de clase | ||
| + | local function buildPerfective(root, clase) | ||
| + | if clase == "sq." then | ||
| + | return root .. "squa" | ||
| + | elseif clase == "su." then | ||
| + | return root .. "suca" | ||
| + | else | ||
| + | return root | ||
| + | end | ||
| + | end | ||
| + | |||
| + | -- Forma irrealis: usa -nga (reemplaza la terminación de clase) | ||
| + | local function buildIrrealis(root) | ||
| + | return root .. "nga" | ||
end | end | ||
| Línea 30: | Línea 47: | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
| − | -- clase = sq. | + | -- Parámetros de la plantilla |
| − | local | + | 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 | ||
local pageName = mw.title.getCurrentTitle().text | local pageName = mw.title.getCurrentTitle().text | ||
| − | local root = getRoot(pageName, clase) | + | local root = getRoot(pageName, clase, manualRoot) |
| − | |||
if root == "" then | if root == "" then | ||
return "<span style='color:red;'>Error: no se pudo identificar la raíz.</span>" | return "<span style='color:red;'>Error: no se pudo identificar la raíz.</span>" | ||
end | end | ||
| − | local | + | local persons = { |
| − | + | {"1sg", "z-"}, | |
| − | + | {"2sg", "m-"}, | |
| − | + | {"3", "a-"}, | |
| − | + | {"1pl", "chi-"}, | |
| − | + | {"2pl", "mi-"} | |
} | } | ||
| + | |||
| + | local perfectiveBase = buildPerfective(root, clase) | ||
| + | local irrealisBase = buildIrrealis(root) | ||
local html = mw.html.create("table") | local html = mw.html.create("table") | ||
| Línea 60: | Línea 78: | ||
local header = html:tag("tr") | local header = html:tag("tr") | ||
header:tag("th"):wikitext("Persona") | header:tag("th"):wikitext("Persona") | ||
| − | header:tag("th"):wikitext(" | + | header:tag("th"):wikitext("Perfectivo") |
| + | header:tag("th"):wikitext("Irrealis") | ||
-- Filas | -- Filas | ||
| − | local | + | for _, personData in ipairs(persons) do |
| + | local label = personData[1] | ||
| + | local prefix = personData[2] | ||
| − | |||
local row = html:tag("tr") | local row = html:tag("tr") | ||
| − | row:tag("td"):wikitext( | + | row:tag("td"):wikitext(label) |
| − | row:tag("td"):wikitext( | + | row:tag("td"):wikitext(prefix .. perfectiveBase) |
| + | row:tag("td"):wikitext(prefix .. irrealisBase) | ||
end | end | ||
| − | |||
local output = "" | local output = "" | ||
| − | + | 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>Raíz detectada:</b> %s</div>", root) | |
| − | + | output = output .. string.format("<div><b>Hipótesis TAM:</b> perfectivo Ø; irrealis -nga</div>") | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | output = output .. string.format( | ||
| − | |||
| − | |||
| − | ) | ||
output = output .. tostring(html) | output = output .. tostring(html) | ||
Revisión del 20:13 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()", "")
return pageName
end
-- Detecta la raíz automáticamente según la clase
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
-- Forma perfectiva (no marcada): usa la terminación de clase
local function buildPerfective(root, clase)
if clase == "sq." then
return root .. "squa"
elseif clase == "su." then
return root .. "suca"
else
return root
end
end
-- Forma irrealis: usa -nga (reemplaza la terminación de clase)
local function buildIrrealis(root)
return root .. "nga"
end
function p.render(frame)
local args = frame:getParent().args
-- Parámetros de la plantilla
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, clase)
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("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 .. irrealisBase)
end
local output = ""
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>Raíz detectada:</b> %s</div>", root)
output = output .. string.format("<div><b>Hipótesis TAM:</b> perfectivo Ø; irrealis -nga</div>")
output = output .. tostring(html)
return output
end
return p
