Module:rad-stem/templates: Difference between revisions

Jump to navigation Jump to search
Finished
mNo edit summary
(Finished)
Line 1: Line 1:
--[[
WORK IN PROGRESS
]]--
local export = {}
local export = {}
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs
Line 92: Line 88:
adj_broken = args['adjbreak'] or break_adj(adj)  
adj_broken = args['adjbreak'] or break_adj(adj)  
adj_broken_e = mw.ustring.gsub(adj_broken, "(uș)$", "ûș")
adj_broken_e = mw.ustring.gsub(adj_broken, "(uș)$", "ûș")
adj_broken_e = mw.ustring.gsub(adj_broken, "(aûș)$", "auș")
adj_broken_e = mw.ustring.gsub(adj_broken_e, "(aûș)$", "auș")
adj_broken_e = mw.ustring.gsub(adj_broken, "(aùș)$", "aûș")
adj_broken_e = mw.ustring.gsub(adj_broken_e, "(aùș)$", "aûș")
adj_broken_e = adj_broken_e .. "e"
adj_broken_e = adj_broken_e .. "e"
adj = mw.ustring.gsub(adj, "(°)", "")
adj = mw.ustring.gsub(adj, "(°)", "")
Line 142: Line 138:
local nom_cite = nom
local nom_cite = nom
nom = rad_link_IPA(nom)
nom = rad_link_IPA(nom)
local gen = stems.gen
local function get_forms(case, base, adj_base, adj_ending, nolink)
if adj_broken then gen = gen .. adj_broken .. "k" end
if adj_base then
if post then gen = gen .. post end
base = base .. adj_base
if args['altgen'] then
if adj_ending then base = base .. adj_ending end
end
if post then base = base .. post end
if args['alt' .. case] then
local list = {
local list = {
[1] = {['word'] = gen},
[1] = {['word'] = base},
[2] = {['word'] = args['altgen'], ['note'] = args['altgen_note']}
[2] = {['word'] = args['alt' .. case], ['note'] = args['alt' .. case .. '_note']}
}
}
if adj_broken then list[2]['word'] = list[2]['word'] .. adj_broken .. "k" end
if adj_base then
list[2]['word'] = list[2]['word'] .. adj_base
if adj_ending then list[2]['word'] = list[2]['word'] .. adj_ending end
end
if post then list[2]['word'] = list[2]['word'] .. post end
if post then list[2]['word'] = list[2]['word'] .. post end
local counter = 2
local counter = 2
while args['altgen' .. counter] do
while args['alt' .. case .. counter] do
local temp = args['altgen' .. counter]
local temp = args['alt' .. case .. counter]
if adj_broken then temp = temp .. adj_broken .. "k" end
if adj_base then
temp = temp .. adj_base
if adj_ending then temp = temp .. adj_ending end
end
if post then temp = temp .. post end
if post then temp = temp .. post end
list[counter + 1] = {['word'] = temp, ['note'] = args['altgen' .. counter .. "_note"]}
list[counter + 1] = {['word'] = temp, ['note'] = args['alt' .. case .. counter .. "_note"]}
counter = counter + 1
counter = counter + 1
end
end
gen = rad_link_IPA(list)
return rad_link_IPA(list)
else
else
gen = rad_link_IPA(gen)
if nolink then
return base
else
return rad_link_IPA(base)
end
end
end
end
local gen = get_forms("gen", stems.gen, adj_broken, "k")
local dat = get_forms("dat", stems.dat, adj, "a")
local acc = get_forms("acc", stems.acc, adj_broken, "t")
local ins = get_forms("ins", stems.ins, adj, "úr")
local nompl = get_forms("nompl", stems.nompl, adj_broken_e)
local nompl_cite = get_forms("nompl", stems.nompl, adj_broken_e, "", true)
local genpl = get_forms("genpl", stems.genpl .. "ris", adj, "eris")
local genpl_short = get_forms("genpl_short", stems.genpl_short, adj, "es")
local datpl = get_forms("genpl", stems.genpl .. "rín", adj, "erín")
local accpl = get_forms("accpl", stems.genpl .. "rid", adj, "erid")
local inspl = get_forms("inspl", stems.genpl .. "ríe", adj, "eríe")
local nomdu = get_forms("nomdu", stems.dat .. "te", adj_broken_e)
local nomdu_cite = get_forms("nomdu", stems.dat .. "te", adj_broken_e, "", true)
local gendu = get_forms("gendu", stems.dat .. "tis", adj, "eris")
local gendu_short = get_forms("gendu_short", stems.dat .. "ts", adj, "es")
local datdu = get_forms("datdu", stems.dat .. "tín", adj, "erín")
local accdu = get_forms("accdu", stems.dat .. "tid", adj, "erid")
local insdu = get_forms("insdu", stems.dat .. "tíe", adj, "eríe")
add("<table class=\"mw-collapsible mw-collapsed wikitable inflection table\" style=\"text-align: center\">")
add("<table class=\"mw-collapsible mw-collapsed wikitable inflection table\" style=\"text-align: center\">")
if table_type == "sgpl" then
if table_type == "sgpl" then
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp", 1, 4)
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 4)
add("<tr>")
th("", 1, 2)
th("singular")
th("plural")
add("</tr>")
add("<tr>")
add("<tr>")
th("nominative", 1, 2)
th("nominative", 1, 2)
Line 176: Line 211:
else
else
td(nom)
td(nom)
td(nompl)
end
end
add("</tr>")
add("</tr>")
add("<tr>")
add("<tr>")
th("genitive", 2, 1)
th("genitive", 2, 1)
th("proper")
th("long")
td(gen, 2, 1)
td(genpl)
add("</tr>")
add("<tr>")
th("short")
td(genpl_short)
add("</tr>")
add("<tr>")
th("dative", 1, 2)
td(dat)
td(datpl)
add("</tr>")
add("<tr>")
th("accusative", 1, 2)
td(acc)
td(accpl)
add("</tr>")
add("<tr>")
th("instrumental", 1, 2)
td(ins)
td(inspl)
add("</tr>")
elseif table_type == "sg" then
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 2)
add("<tr>")
th("")
th("singular")
add("</tr>")
add("<tr>")
th("nominative")
td(nom)
add("</tr>")
add("<tr>")
th("genitive")
td(gen)
td(gen)
add("</tr>")
add("</tr>")
elseif table_type == "sg" then
add("<tr>")
th("dative")
td(dat)
add("</tr>")
add("<tr>")
th("accusative")
td(acc)
add("</tr>")
add("<tr>")
th("instrumental")
td(ins)
add("</tr>")
elseif table_type == "pl" then
elseif table_type == "pl" then
th("Declension of <i>" .. nompl_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 3)
add("<tr>")
th("", 1, 2)
th("plural")
add("</tr>")
add("<tr>")
th("nominative", 1, 2)
td(nompl)
add("</tr>")
add("<tr>")
th("genitive", 2, 1)
th("long")
td(genpl)
add("</tr>")
add("<tr>")
th("short")
td(genpl_short)
add("</tr>")
add("<tr>")
th("dative", 1, 2)
td(datpl)
add("</tr>")
add("<tr>")
th("accusative", 1, 2)
td(accpl)
add("</tr>")
add("<tr>")
th("instrumental", 1, 2)
td(inspl)
add("</tr>")
elseif table_type == "du" then
elseif table_type == "du" then
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 5)
add("<tr>")
th("", 2, 2)
th("singular", 2, 1)
th("plural", 1, 2)
add("</tr>")
add("<tr>")
th("binary")
th("true")
add("</tr>")
add("<tr>")
th("nominative", 1, 2)
td(nom)
td(nomdu)
td(nompl)
add("</tr>")
add("<tr>")
th("genitive", 2, 1)
th("long")
td(gen, 2, 1)
td(gendu)
td(genpl)
add("</tr>")
add("<tr>")
th("short")
td(gendu_short)
td(genpl_short)
add("</tr>")
add("<tr>")
th("dative", 1, 2)
td(dat)
td(datdu)
td(datpl)
add("</tr>")
add("<tr>")
th("accusative", 1, 2)
td(acc)
td(accdu)
td(accpl)
add("</tr>")
add("<tr>")
th("instrumental", 1, 2)
td(ins)
td(insdu)
td(inspl)
add("</tr>")
elseif table_type == "dupl" then
elseif table_type == "dupl" then
th("Declension of <i>" .. nomdu_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 3)
add("<tr>")
th("", 1, 2)
th("binary plural")
add("</tr>")
add("<tr>")
th("nominative", 1, 2)
td(nomdu)
add("</tr>")
add("<tr>")
th("genitive", 2, 1)
th("long")
td(gendu)
add("</tr>")
add("<tr>")
th("short")
td(gendu_short)
add("</tr>")
add("<tr>")
th("dative", 1, 2)
td(datdu)
add("</tr>")
add("<tr>")
th("accusative", 1, 2)
td(accdu)
add("</tr>")
add("<tr>")
th("instrumental", 1, 2)
td(insdu)
add("</tr>")
end
end
add("</table>")
add("</table>")
add("<includeonly>")
if args['notags'] ~= "true" or args['notags'] == nil then
add("[[Category:" .. m_languages.get_by_code("rad").name .. " " .. type_name .. " stems]]")
add("<includeonly>")
if table_type == "sg" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " singularia tantum]]")
add("[[Category:" .. m_languages.get_by_code("rad").name .. " " .. type_name .. " stems]]")
elseif table_type == "pl" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " pluralia tantum]]")
if table_type == "sg" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " singularia tantum]]")
elseif table_type == "du" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " pluralia binaria]]")
elseif table_type == "pl" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " pluralia tantum]]")
elseif table_type == "dupl" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " pluralia binaria tantum]]")
elseif table_type == "du" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " pluralia binaria]]")
end
elseif table_type == "dupl" then add("[[Category:" .. m_languages.get_by_code("rad").name .. " pluralia binaria tantum]]")
add("</includeonly>")
end
add("</includeonly>")
end
return table.concat(format_table, string.char(10))
return table.concat(format_table, string.char(10))

Navigation menu