Module:smi-pro-nouns
Jump to navigation
Jump to search
- The following documentation is located at Module:smi-pro-nouns/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local lang = require("Module:languages").getByCode("smi-pro")
local export = {}
function export.even(frame)
local params = {
[1] = {required = true, default = "{{{1}}}"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "even", categories = {lang:getCanonicalName() .. " even nouns"}}
local umlaut_j = args[1]
local umlaut_e = args[1]
local umlaut_je = args[1]
if mw.ustring.find(args[1], "[aeiouāēōë]$") then
local vowel = mw.ustring.match(args[1], "[aeiouāēōë]+$")
table.insert(data.categories, lang:getCanonicalName() .. " even " .. vowel .. "-stem nouns")
umlaut_j = mw.ustring.gsub(args[1], "ē$", "i")
umlaut_je = mw.ustring.gsub(umlaut_j, "ō$", "u")
umlaut_e = mw.ustring.gsub(umlaut_e, "ē$", "ā")
umlaut_e = mw.ustring.gsub(umlaut_e, "ō$", "u")
else
table.insert(data.categories, lang:getCanonicalName() .. " even consonant-stem nouns")
end
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {args[1] .. "m"}
data.forms["par_sg"] = {args[1] .. "tē"}
data.forms["gen_sg"] = {args[1] .. "n"}
data.forms["ess_sg"] = {args[1] .. "nē"}
data.forms["ine_sg"] = {args[1] .. "snē"}
data.forms["ela_sg"] = {args[1] .. "stē"}
data.forms["ill_sg"] = {umlaut_e .. "sën"}
data.forms["com_sg"] = {umlaut_j .. "jnē", umlaut_je .. "jnë"}
data.forms["abe_sg"] = {args[1] .. "ptākëk"}
data.forms["nom_pl"] = {args[1] .. "k"}
data.forms["acc_pl"] = {umlaut_j .. "jtē"}
data.forms["gen_pl"] = {umlaut_j .. "j"}
data.forms["ine_pl"] = {umlaut_j .. "jnē"}
data.forms["ela_pl"] = {umlaut_j .. "jstē"}
-- Apply gradation
for key, forms in pairs(data.forms) do
for i, form in ipairs(forms) do
forms[i] = require("Module:smi-pro-common").apply_gradation(form)
end
end
return make_table(data) .. require("Module:utilities").format_categories(data.categories, lang)
end
function export.odd(frame)
local params = {
[1] = {required = true, default = "{{{1}}}"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {forms = {}, info = "odd", categories = {lang:getCanonicalName() .. " odd nouns"}}
local xstem = args[1]
local umlaut_j = args[1]
local umlaut_e = args[1]
if mw.ustring.find(args[1], "[aeiouāēōë]$") then
local vowel = mw.ustring.match(args[1], "[aeiouāēōë]+$")
table.insert(data.categories, lang:getCanonicalName() .. " odd " .. vowel .. "-stem nouns")
umlaut_j = mw.ustring.gsub(args[1], "ē$", "i")
umlaut_e = mw.ustring.gsub(umlaut_e, "ē$", "ā")
umlaut_e = mw.ustring.gsub(umlaut_e, "ō$", "u")
else
table.insert(data.categories, lang:getCanonicalName() .. " odd consonant-stem nouns")
umlaut_e = mw.ustring.gsub(umlaut_e, "ē([^aeiouāēōë])$", "ā%1")
umlaut_e = mw.ustring.gsub(umlaut_e, "ō([^aeiouāēōë])$", "u%1")
xstem = umlaut_e .. "ë"
end
data.forms["nom_sg"] = {args[1]}
data.forms["acc_sg"] = {xstem .. "m"}
data.forms["par_sg"] = {args[1] .. "tē"}
data.forms["gen_sg"] = {xstem .. "n"}
data.forms["ess_sg"] = {args[1] .. "nē"}
data.forms["ine_sg"] = {xstem .. "snē"}
data.forms["ela_sg"] = {xstem .. "stē"}
data.forms["ill_sg"] = {umlaut_e .. "sën"}
data.forms["com_sg"] = {xstem .. "jnē", xstem .. "jnë"}
data.forms["abe_sg"] = {xstem .. "ptākëk"}
data.forms["nom_pl"] = {xstem .. "k"}
data.forms["acc_pl"] = {xstem .. "jtē"}
data.forms["gen_pl"] = {xstem .. "j"}
data.forms["ine_pl"] = {xstem .. "jnē"}
data.forms["ela_pl"] = {xstem .. "jstē"}
-- Apply gradation
for key, forms in pairs(data.forms) do
for i, form in ipairs(forms) do
forms[i] = require("Module:smi-pro-common").apply_gradation(form)
end
end
return make_table(data) .. require("Module:utilities").format_categories(data.categories, lang)
end
-- Make the table
function make_table(data)
local function repl(param)
if param == "info" then
return mw.getContentLanguage():ucfirst(data.info or "")
end
local form = data.forms[param]
if not form then
return "—"
end
local ret = {}
for key, subform in ipairs(form) do
table.insert(ret, require("Module:links").full_link({lang = lang, alt = "*" .. subform}))
end
return table.concat(ret, "<br/>")
end
local wikicode = [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="border: solid 1px #CCCCFF; text-align: left;" cellspacing="1" cellpadding="2"
|- style="background: #E2F6E2; text-align: left;"
! class="vsToggleElement" colspan="3" | {{{info}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="min-width: 8em; background: #E2F6E2;" | Nominative
| style="min-width: 12em;" | {{{nom_sg}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="min-width: 8em; background: #E2F6E2;" | Genitive
| style="min-width: 12em;" | {{{gen_sg}}}
|- class="vsHide"
! style="min-width: 8em; background:#c0e4c0" |
! style="min-width: 12em; background:#c0e4c0" | Singular
! style="min-width: 12em; background:#c0e4c0" | Plural
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Nominative
| {{{nom_sg}}}
| {{{nom_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Accusative
| {{{acc_sg}}}
| rowspan="2" | {{{acc_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Partitive
| {{{par_sg}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Genitive
| {{{gen_sg}}}
| {{{gen_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Essive
| {{{ess_sg}}}
| rowspan="2" | {{{ine_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Inessive
| {{{ine_sg}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Elative
| {{{ela_sg}}}
| {{{ela_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Illative
| {{{ill_sg}}}
| {{{ill_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Comitative
| {{{com_sg}}}
| {{{com_pl}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | Abessive
| {{{abe_sg}}}
| {{{abe_pl}}}
|}]=]
return mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)
end
return export