De Muysc cubun - Lengua Muisca
m |
m |
||
| Línea 9: | Línea 9: | ||
end | end | ||
| − | local function | + | -- Nueva función para desglosar el tipo (ej: "sq. tr. i") |
| − | + | local function parseType(rawType) | |
| − | + | rawType = mw.ustring.lower(rawType or "") | |
| − | if mw.ustring.find( | + | local info = { |
| − | elseif mw.ustring.find( | + | clase = "", |
| − | + | ext = "" -- Aquí guardaremos 'i', 'quy', 'iquy', etc. | |
| + | } | ||
| + | |||
| + | if mw.ustring.find(rawType, "sq") then info.clase = "sq." | ||
| + | elseif mw.ustring.find(rawType, "su") then info.clase = "su." end | ||
| + | |||
| + | -- Extraer el tercer componente (histórico/morfofonológico) | ||
| + | -- Buscamos después de 'tr.' o 'intr.' o simplemente el último espacio | ||
| + | local parts = mw.text.split(rawType, "%s+") | ||
| + | if #parts >= 3 then | ||
| + | info.ext = parts[3] | ||
| + | end | ||
| + | |||
| + | return info | ||
end | end | ||
| Línea 24: | Línea 37: | ||
if clase == "sq." then root = mw.ustring.gsub(fullVerb, "squa$", "") | if clase == "sq." then root = mw.ustring.gsub(fullVerb, "squa$", "") | ||
elseif clase == "su." then root = mw.ustring.gsub(fullVerb, "suca$", "") end | elseif clase == "su." then root = mw.ustring.gsub(fullVerb, "suca$", "") end | ||
| − | |||
return root | return root | ||
end | end | ||
| − | -- 2. Función | + | -- 2. Función generadora de tablas |
| − | local function generateTableHtml(title, root, persons, suffixes, applySpecialRule, colNames) | + | local function generateTableHtml(title, root, persons, suffixes, applySpecialRule, colNames, ext) |
| − | local wrapper = mw.html.create("div") | + | local wrapper = mw.html.create("div"):css("margin-bottom", "1.5em") |
| − | + | wrapper:tag("div"):css("font-weight", "bold"):css("font-size", "1.1em"):css("margin-bottom", "0.4em"):wikitext(title) | |
| − | |||
| − | |||
| − | |||
| − | wrapper:tag("div") | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| + | local html = wrapper:tag("table"):addClass("wikitable"):css("width", "100%"):css("max-width", "600px") | ||
local header = html:tag("tr") | local header = html:tag("tr") | ||
header:tag("th"):wikitext("Persona") | header:tag("th"):wikitext("Persona") | ||
| − | + | for i=1,3 do header:tag("th"):wikitext(colNames[i]) end | |
| − | |||
| − | |||
local firstChar = mw.ustring.lower(mw.ustring.sub(root, 1, 1)) | local firstChar = mw.ustring.lower(mw.ustring.sub(root, 1, 1)) | ||
| Línea 59: | Línea 55: | ||
for _, personData in ipairs(persons) do | for _, personData in ipairs(persons) do | ||
local label, prefix = personData[1], personData[2] | local label, prefix = personData[1], personData[2] | ||
| + | |||
| + | -- Regla especial para 1.ª sg. (i- / z-) | ||
if applySpecialRule and label == "1.ª sg." then | if applySpecialRule and label == "1.ª sg." then | ||
if firstChar == "n" or firstChar == "z" or firstChar == "t" or firstTwo == "ch" then | if firstChar == "n" or firstChar == "z" or firstChar == "t" or firstTwo == "ch" then | ||
| Línea 64: | Línea 62: | ||
end | end | ||
end | end | ||
| + | |||
| + | -- Lógica de mutación de raíz para nominalizaciones | ||
| + | -- Si hay extensión (i, quy, etc.), se aplica a Factual e Irrealis | ||
| + | local rootFactual = root | ||
| + | local rootIrrealis = root | ||
| + | |||
| + | if ext ~= "" then | ||
| + | -- Aquí podrías añadir más lógica si 'quy' o 'iquy' se comportan distinto | ||
| + | rootFactual = root .. ext | ||
| + | rootIrrealis = root .. ext | ||
| + | end | ||
| + | |||
local row = html:tag("tr") | local row = html:tag("tr") | ||
row:tag("td"):css("font-weight", "bold"):wikitext(label) | row:tag("td"):css("font-weight", "bold"):wikitext(label) | ||
| + | |||
| + | -- Columna 1: Resultativa (Normalmente usa raíz pura) | ||
row:tag("td"):wikitext(prefix .. root .. (suffixes.perf or "")) | row:tag("td"):wikitext(prefix .. root .. (suffixes.perf or "")) | ||
| − | row:tag("td"):wikitext(prefix .. | + | -- Columna 2: Factual (Usa raíz mutada) |
| − | row:tag("td"):wikitext(prefix .. | + | row:tag("td"):wikitext(prefix .. rootFactual .. (suffixes.imperf or "")) |
| + | -- Columna 3: Irrealis (Usa raíz mutada) | ||
| + | row:tag("td"):wikitext(prefix .. rootIrrealis .. (suffixes.irreal or "")) | ||
end | end | ||
return wrapper | return wrapper | ||
end | end | ||
| − | |||
function p.render(frame) | function p.render(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
| − | local | + | local typeInfo = parseType(args.clase or args.tipo or "") |
| − | local | + | local root = getRoot(mw.title.getCurrentTitle().text, typeInfo.clase, args.raiz or "") |
| − | |||
| − | + | -- Series | |
| − | |||
| − | |||
| − | |||
| − | -- | ||
local serie1 = { | local serie1 = { | ||
title = "Serie de Flexión Verbal (Independiente)", | title = "Serie de Flexión Verbal (Independiente)", | ||
persons = {{"1.ª sg.", "z-"}, {"2.ª sg.", "m-"}, {"3.ª", "a-"}, {"1.ª pl.", "chi-"}, {"2.ª pl.", "mi-"}}, | persons = {{"1.ª sg.", "z-"}, {"2.ª sg.", "m-"}, {"3.ª", "a-"}, {"1.ª pl.", "chi-"}, {"2.ª pl.", "mi-"}}, | ||
| − | suffixes = {perf = "", imperf = (clase == "su." and "-suca" or "-squa"), irreal = "-nga"}, | + | suffixes = {perf = "", imperf = (typeInfo.clase == "su." and "-suca" or "-squa"), irreal = "-nga"}, |
rule = true, | rule = true, | ||
cols = {"Perfectivo", "Imperfectivo", "Irrealis"} | cols = {"Perfectivo", "Imperfectivo", "Irrealis"} | ||
} | } | ||
| − | |||
local serie2 = { | local serie2 = { | ||
title = "Serie de Nominalización", | title = "Serie de Nominalización", | ||
| Línea 101: | Línea 108: | ||
} | } | ||
| − | + | local mainDiv = mw.html.create("div"):addClass("mw-collapsible"):addClass("mw-collapsed") | |
| − | local mainDiv = mw.html.create("div") | + | :css("border", "1px solid #a2a9b1"):css("padding", "15px"):css("background-color", "#fcfcfc") |
| − | + | :attr("data-expandtext", "Conjugar"):attr("data-collapsetext", "Ocultar") | |
| − | |||
| − | :css("border", "1px solid #a2a9b1") | ||
| − | |||
| − | |||
| − | :attr("data-expandtext", "Conjugar") | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | mainDiv:tag("div"):css("font-weight", "bold"):css("border-bottom", "1px solid #a2a9b1") | |
| − | : | + | :css("margin-bottom", "15px"):css("padding-bottom", "5px"):wikitext("Paradigma de " .. root) |
| − | -- | + | local contentDiv = mainDiv:tag("div"):addClass("mw-collapsible-content") |
| − | contentDiv:node(generateTableHtml(serie1.title, root, serie1.persons, serie1.suffixes, serie1.rule, serie1.cols)) | + | |
| − | contentDiv:node(generateTableHtml(serie2.title, root, serie2.persons, serie2.suffixes, serie2.rule, serie2.cols)) | + | -- Serie 1 (Normalmente no muta la raíz, pero si quieres que lo haga, pasamos typeInfo.ext) |
| + | contentDiv:node(generateTableHtml(serie1.title, root, serie1.persons, serie1.suffixes, serie1.rule, serie1.cols, "")) | ||
| + | -- Serie 2 (Aquí aplicamos la mutación histórica) | ||
| + | contentDiv:node(generateTableHtml(serie2.title, root, serie2.persons, serie2.suffixes, serie2.rule, serie2.cols, typeInfo.ext)) | ||
return tostring(mainDiv) | return tostring(mainDiv) | ||
Revisión del 22:13 26 mar 2026
La documentación para este módulo puede ser creada en Módulo:Conjugador/doc
local p = {}
-- 1. Limpieza y Normalización
local function cleanPageName(pageName)
pageName = mw.text.trim(pageName or "")
pageName = mw.ustring.gsub(pageName, "%s*%b()", "")
pageName = mw.ustring.gsub(pageName, "%d+", "")
return mw.text.trim(pageName)
end
-- Nueva función para desglosar el tipo (ej: "sq. tr. i")
local function parseType(rawType)
rawType = mw.ustring.lower(rawType or "")
local info = {
clase = "",
ext = "" -- Aquí guardaremos 'i', 'quy', 'iquy', etc.
}
if mw.ustring.find(rawType, "sq") then info.clase = "sq."
elseif mw.ustring.find(rawType, "su") then info.clase = "su." end
-- Extraer el tercer componente (histórico/morfofonológico)
-- Buscamos después de 'tr.' o 'intr.' o simplemente el último espacio
local parts = mw.text.split(rawType, "%s+")
if #parts >= 3 then
info.ext = parts[3]
end
return info
end
local function getRoot(pageName, clase, manualRoot)
manualRoot = mw.text.trim(manualRoot or "")
if manualRoot ~= "" then return manualRoot end
local fullVerb = cleanPageName(pageName)
local root = fullVerb
if clase == "sq." then root = mw.ustring.gsub(fullVerb, "squa$", "")
elseif clase == "su." then root = mw.ustring.gsub(fullVerb, "suca$", "") end
return root
end
-- 2. Función generadora de tablas
local function generateTableHtml(title, root, persons, suffixes, applySpecialRule, colNames, ext)
local wrapper = mw.html.create("div"):css("margin-bottom", "1.5em")
wrapper:tag("div"):css("font-weight", "bold"):css("font-size", "1.1em"):css("margin-bottom", "0.4em"):wikitext(title)
local html = wrapper:tag("table"):addClass("wikitable"):css("width", "100%"):css("max-width", "600px")
local header = html:tag("tr")
header:tag("th"):wikitext("Persona")
for i=1,3 do header:tag("th"):wikitext(colNames[i]) end
local firstChar = mw.ustring.lower(mw.ustring.sub(root, 1, 1))
local firstTwo = mw.ustring.lower(mw.ustring.sub(root, 1, 2))
for _, personData in ipairs(persons) do
local label, prefix = personData[1], personData[2]
-- Regla especial para 1.ª sg. (i- / z-)
if applySpecialRule and label == "1.ª sg." then
if firstChar == "n" or firstChar == "z" or firstChar == "t" or firstTwo == "ch" then
prefix = "i-"
end
end
-- Lógica de mutación de raíz para nominalizaciones
-- Si hay extensión (i, quy, etc.), se aplica a Factual e Irrealis
local rootFactual = root
local rootIrrealis = root
if ext ~= "" then
-- Aquí podrías añadir más lógica si 'quy' o 'iquy' se comportan distinto
rootFactual = root .. ext
rootIrrealis = root .. ext
end
local row = html:tag("tr")
row:tag("td"):css("font-weight", "bold"):wikitext(label)
-- Columna 1: Resultativa (Normalmente usa raíz pura)
row:tag("td"):wikitext(prefix .. root .. (suffixes.perf or ""))
-- Columna 2: Factual (Usa raíz mutada)
row:tag("td"):wikitext(prefix .. rootFactual .. (suffixes.imperf or ""))
-- Columna 3: Irrealis (Usa raíz mutada)
row:tag("td"):wikitext(prefix .. rootIrrealis .. (suffixes.irreal or ""))
end
return wrapper
end
function p.render(frame)
local args = frame:getParent().args
local typeInfo = parseType(args.clase or args.tipo or "")
local root = getRoot(mw.title.getCurrentTitle().text, typeInfo.clase, args.raiz or "")
-- Series
local serie1 = {
title = "Serie de Flexión Verbal (Independiente)",
persons = {{"1.ª sg.", "z-"}, {"2.ª sg.", "m-"}, {"3.ª", "a-"}, {"1.ª pl.", "chi-"}, {"2.ª pl.", "mi-"}},
suffixes = {perf = "", imperf = (typeInfo.clase == "su." and "-suca" or "-squa"), irreal = "-nga"},
rule = true,
cols = {"Perfectivo", "Imperfectivo", "Irrealis"}
}
local serie2 = {
title = "Serie de Nominalización",
persons = {{"1.ª sg.", "cha-"}, {"2.ª sg.", "ma-"}, {"3.ª", ""}, {"1.ª pl.", "chi-"}, {"2.ª pl.", "mi-"}},
suffixes = {perf = "-ia", imperf = "-sca", irreal = "-nga"},
rule = false,
cols = {"Nominalización Resultativa", "Nominalización Factual", "Nominalización Irrealis"}
}
local mainDiv = mw.html.create("div"):addClass("mw-collapsible"):addClass("mw-collapsed")
:css("border", "1px solid #a2a9b1"):css("padding", "15px"):css("background-color", "#fcfcfc")
:attr("data-expandtext", "Conjugar"):attr("data-collapsetext", "Ocultar")
mainDiv:tag("div"):css("font-weight", "bold"):css("border-bottom", "1px solid #a2a9b1")
:css("margin-bottom", "15px"):css("padding-bottom", "5px"):wikitext("Paradigma de " .. root)
local contentDiv = mainDiv:tag("div"):addClass("mw-collapsible-content")
-- Serie 1 (Normalmente no muta la raíz, pero si quieres que lo haga, pasamos typeInfo.ext)
contentDiv:node(generateTableHtml(serie1.title, root, serie1.persons, serie1.suffixes, serie1.rule, serie1.cols, ""))
-- Serie 2 (Aquí aplicamos la mutación histórica)
contentDiv:node(generateTableHtml(serie2.title, root, serie2.persons, serie2.suffixes, serie2.rule, serie2.cols, typeInfo.ext))
return tostring(mainDiv)
end
return p
