Dieses Lua-Modul dient dem Erstellen von Deklinationsboxen für Substantive der estnischen Sprache und wird über die Vorlage Vorlage:Estnisch Substantiv Übersicht eingebunden.
local flex = {}
function flex.deklination(frame)
local text, stem
local vocal = ""
local p2 = ""
local args
if frame == mw.getCurrentFrame() then
args = frame:getParent().args
else
args = frame.args
end
local class = args or "1"
local s = {}
local p = {}
-- Endungen der Kasi
local e = {"", "", "", "sse", "s", "st", "le", "l", "lt", "ks", "ni", "na", "ta", "ga"}
s = args or args
if s=="" then s=nil end
s = args or mw.title.getCurrentTitle().text
s = args or s
stemN1 = mw.ustring.sub(s,1,-2)
stemG1 = mw.ustring.sub(s,1,-2)
stem = s
if string.find("#1e#2e#3e#5e#10#12#13#14#15#17e#17i#17u#19#22#", "#" .. class .. "#") then stem = mw.ustring.sub(stem,1,-2) end
if string.find("#18e#18u#21#", "#" .. class .. "#") then stem = mw.ustring.sub(s,1,-2) end
if string.find("#22e#22i#22u#23e#23i#", "#" .. class .. "#") then
stem2 = mw.ustring.sub(stem,1,-2)
stem = s
end
-- Partitiv Singular
s = args or args or s or s .. "t"
if string.find("#1#1e#2#2e#3#3e#", "#" .. class .. "#") then s = args or args or s .. "t" end
if string.find("#4#5#5e#6#7#7e#8#9#11#13#16#", "#" .. class .. "#") then s = args or args or s .. "t" end
if string.find("#10#12#14#", "#"..class.."#") then s = args or args or stemG1 .. "t" end
if string.find("#15#", "#"..class.."#") then s = args or args or stemG1 .. "tt" end
if string.find("#17#17e#17i#17u#18#18e#18u#", "#"..class.."#") then s = args or args or s end
if string.find("#21#", "#"..class.."#") then s = args or args or stemN1 .. "e" end
if string.find("#19#20#22#24#24e#", "#"..class.."#") then s = args or args or s end
if string.find("#22e#23e#", "#"..class.."#") then s = args or args or s .. "i" end
if string.find("#22u#23i#23u#22i#", "#"..class.."#") then s = args or args or s .. "a" end
if string.find("#26#26i#", "#"..class.."#") then s = args or args or s .. "d" end
stemP1 = mw.ustring.sub(s,1,-2)
-- Illativ Singular
s = args or s .. "sse"
if s then s = args or s .. ", " .. s end
-- Genitiv Plural
p = args or s .. "te"
if string.find("#6#7#7e#9#11#13#", "#" .. class .. "#") then p = args or s .. "te" end
if string.find("#8#16#17#17e#17i#17u#18#18e#18u#26#26i#", "#"..class.."#") then p = args or s .. "de" end
if string.find("#10#12#15#", "#"..class.."#") then p = args or stemG1 .. "te" end
if string.find("#19#20#24#24e#", "#"..class.."#") then p = args or s .. "de" end
if string.find("#21#22#22e#22i#22u#23e#23i#23u#24i#24u#25#", "#"..class.."#") then p = args or s .. "de" end
if string.find("#14#", "#"..class.."#") then p = args or s .. "e" end
if string.find("#23e#", "#"..class.."#") then p2 = args or stemN1 .. "te" end
if string.find("#23i#23u#", "#"..class.."#") then p2 = args or s .. "te" end
if string.find("#25#", "#"..class.."#") then p2 = args or s .. "e" end
-- Partitiv Plural
p = args or s .. "id"
if string.find("#1e#2e#3e#5e#7e#", "#"..class.."#") then p = args or stemG1 .. "eid" end
if string.find("#11#14#", "#"..class.."#") then p = args or s .. "i" end
if string.find("#12#13#", "#"..class.."#") then p = args or stemG1 .. "i" end
if string.find("#15#", "#"..class.."#") then p = args or s end
if string.find("#16#17#17e#17i#17u#18#18e#18u#26#26i#", "#"..class.."#") then p = args or s .. "sid" end
if string.find("#19#20#", "#"..class.."#") then p = args or s .. "sid" end
if string.find("#21#22#22e#22i#22u#23e#23i#23u#24#24e#24i#24u#25#", "#"..class.."#") then p = args or s .. "sid" end
if string.find("#17e#18e#", "#"..class.."#") then p = args or stemN1 .. "e, " .. p end
if string.find("#17i##", "#"..class.."#") then p = args or stemN1 .. "i, " .. p end
if string.find("#17u#18u#", "#"..class.."#") then p = args or stemN1 .. "u, " .. p end
if string.find("#19#22e#23e#", "#"..class.."#") then p = args or s .. "e, " .. p end
if string.find("#22i#23i#", "#"..class.."#") then p = args or s .. "i, " .. p end
if string.find("#22u#23u#", "#"..class.."#") then p = args or s .. "u, " .. p end
if string.find("#24e#", "#"..class.."#") then p = args or stemG1 .. "e, " .. p end
if string.find("#24i#", "#"..class.."#") then p = args or stemP1 .. "i, " .. p end
if string.find("#24u#", "#"..class.."#") then p = args or stemP1 .. "u, " .. p end
if string.find("#25#", "#"..class.."#") then p = args or stemP1 .. "e, " .. p end
if string.find("#26i#", "#"..class.."#") then p = args or stemN1 .. "id, " .. p end
-- Illativ Plural
p = args or p .. e
p = args or p .. e
p = args or p .. e
p = args or p .. e
p = args or p .. e
p = args or p .. e
p = args or p .. e
p = args or p .. e
p = args or p .. e
vocal = ""
bracket1 = ""
bracket2 = ""
if string.find("#11#12#13#14#15#17e#17i#17u#18u#19#22e#22i#22u#23#24e#24i#24u#26#","#" .. class .. "#") then bracket1="(" bracket2=")" end
if string.find("#1#2#3#4#5#6#7#8#9#10#11#12#13#14#17i#22i#24i#26i#","#" .. class .. "#") then vocal="i"
elseif string.find("#1e#2e#3e#5e#7e#10#", "#" .. class .. "#") then vocal = "ei"
elseif string.find("#17e#19#22e#24e#", "#" .. class .. "#") then vocal = "e"
elseif string.find("#17u#18u#22u#24u#", "#" .. class .. "#") then vocal = "u"
end
if string.find("#1#2#3#4#5#6#7#8#9#10#","#" .. class .. "#") then
for i=4, 12 do
p = p .. ", " .. s .. vocal .. e
end
elseif string.find("#1e#2e#3e#5e#7e#12#13#18u#22e#22i#22u#24e#24i#24u#", "#" .. class .. "#") then
for i=4, 12 do
p = p .. ", " .. bracket1 .. stemG1 .. vocal .. e .. bracket2
end
elseif string.find("#11#14#15#19#", "#" .. class .. "#") then
for i=4, 12 do
p = p .. ", " .. bracket1 .. s .. vocal .. e .. bracket2
end
elseif string.find("#17e#17i#17u#26i#", "#" .. class .. "#") then
for i=4, 12 do
p = p .. ", " .. bracket1 .. stemN1 .. vocal .. e .. bracket2
end
elseif string.find("#23e#23i#23u#25#", "#" .. class .. "#") then
for i=4, 12 do
p = p .. ", " .. bracket1 .. p2 .. e .. bracket2
end
end
p = args or p .. "ta"
p = args or p .. "ga"
if p2~="" then p = p2 .. ", " .. p end
local Sgdash = args and "—"
local Pldash = args and "—"
local root = mw.html.create('table')
root
:addClass ('wikitable inflection-table float-right hintergrundfarbe2')
:tag('tr')
:css('background-color', '#F4F4F4')
:tag('th')
:wikitext(']')
:done()
:tag('th')
:wikitext(']')
:done()
:tag('th')
:wikitext(']')
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(s))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or s .. "d"))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s))
:done()
:tag('td')
:wikitext(Pldash or flexlink(p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(s))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(s))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "s"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "st"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "le"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "l"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "lt"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "ks"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "ni"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "na"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "ta"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
:tag('tr')
:tag('td')
:css('font-weight', 'bold')
:css('background-color', '#F4F4F4')
:wikitext(']')
:done()
:tag('td')
:wikitext(Sgdash or flexlink(args or s .. "ga"))
:done()
:tag('td')
:wikitext(Pldash or flexlink(args or p))
:done()
:done()
return tostring(root)
end
function flexlink(str)
str = "]"
str = mw.ustring.gsub(str,", ","]]<br />[[")
str = mw.ustring.gsub(str,"%[%[%(","([[")
str = mw.ustring.gsub(str,"%)%]%]","]])")
return str
end
return flex