Modul:Adjektiv

Aus KGS-Wiki

Die Dokumentation für dieses Modul kann unter Modul:Adjektiv/Doku erstellt werden

local p = {}
utils = require('Modul:LateinUtils')

local KASUS  = {'Nominativ', 'Genitiv', 'Dativ', 'Akkusativ', 'Ablativ', 'Vokativ'}
local NUMERI = {S = 'Singular', P = 'Plural'}
local NABBRV = {S = 'Sg.', P = 'Pl.'}
local GENERA = {m = 'maskulinum', f = 'femininum', n = 'neutrum'}
local DEKLS = {
	o = {
		m = {
			S = {'', 'i', 'o', 'um', 'o', 'e'};
			P = {'i', 'orum', 'is', 'os', 'is'}
		};
		f = {
			S = {'', 'ae', 'ae', 'am', 'ā'};
			P = {'ae', 'arum', 'is', 'as', 'is'}
		};
		n = {
			S = {'', 'i', 'o', 'um', 'o'};
			P = {'a', 'orum', 'is', 'a', 'is'}
		};
		name = 'o-/a-Deklination'
	};
	i = {
		m = {
			S = {'', 'is', 'i', 'em', 'i'};
			P = {'es', 'ium', 'ibus', 'es', 'ibus'}
		};
		f = {
			S = {'', 'is', 'i', 'em', 'i'};
			P = {'es', 'ium', 'ibus', 'es', 'ibus'}
		};
		n = {
			S = {'', 'is', 'i', 'em', 'i'};
			P = {'ia', 'ium', 'ibus', 'ia', 'ibus'}
		};
		name = '3. Deklination'
	}
}

function bildeFormen(m,f,n,stamm,dekl)
	formen = {S = {}, P = {}}
	for k,_ in pairs(DEKLS[dekl]['m']['S']) do
		formen['S'][k] = {m = stamm .. DEKLS[dekl]['m']['S'], f = stamm .. DEKLS[dekl]['f']['S'], n = stamm .. DEKLS[dekl]['n']['S']}
		formen['P'][k] = {m = stamm .. DEKLS[dekl]['m']['P'], f = stamm .. DEKLS[dekl]['f']['P'], n = stamm .. DEKLS[dekl]['n']['P']}
	end
	formen['S'][1]['m'] = m
	formen['S'][1]['f'] = f
	formen['S'][1]['n'] = n
	formen['S'][4]['n'] = n
	return formen
end

function renderFormen(formen,dekl)
	local table = ''
	table = table .. '{| class="wikitable mw-collapsible"\n'
	-- LOTS AND LOTS OF WORK TO DO
	table = table .. '|+ ' .. DEKLS[dekl]['name'] .. '\n'
	table = table .. '! colspan="4" ! Singular\n'
	table = table .. '|-\n'
	table = table .. '! !! [[maskulinum]] !! [[femininum]] !! [[neutrum]]\n'
	table = table .. '|}'
	return table
end

function p.render() 
	local frame = mw.getCurrentFrame()
    local baseM = frame.args[1] or frame:getParent().args[1] or 'acer'
    local baseF = frame.args[2] or frame:getParent().args[2] or 'acris'
    local baseN = frame.args[3] or frame:getParent().args[3] or 'acre'
    local stamm = frame.args[4] or frame:getParent().args[4] or 'acr'
    local dekl  = frame.args[5] or frame:getParent().args[5] or 'k'
    local lekt  = frame.args[6] or frame:getParent().args[6] or 32
    local formen = bildeFormen(baseM, baseF, baseN, stamm, dekl)
	local pagecontent = ''
	if not mw.isSubsting() then
    	pagecontent = pagecontent .. utils.renderTemplate("Achtung", {"Dieses Modul sollte nur mit <code>{{subst:#invoke:Adjektiv|...}}</code> eingebunden werden! "})
    end
    pagecontent = pagecontent .. "{{DISPLAYTITLE:" .. basicM .. "}}\n"
    pagecontent = pagecontent .. utils.renderTemplate("Thumbnailbox", {INHALT= utils.renderTemplate("Wortwolke", {basicM})}) .. "\n"
    pagecontent = pagecontent .. ";[[Lernformen]]: " .. utils.enclose(basicM) .. ", " .. utils.enclose(basicF) .. ", " .. utils.enclose(basicN) .. utils.renderTemplate("Link Campus-Lektion", {lekt})
    pagecontent = pagecontent .. '\n\n'
    pagecontent = pagecontent .. ";Bedeutungen\n\n"
    pagecontent = pagecontent .. ";Feste Wendungen\n\n"
    pagecontent = pagecontent .. ";Aufbau\n\n"
    pagecontent = pagecontent .. ";Verwandte Wörter\n\n"
    pagecontent = pagecontent .. ";In anderen Sprachen\n\n"
    pagecontent = pagecontent .. "== Formen ==\n\n"
    pagecontent = pagecontent .. renderFormen(formen, dekl)
    pagecontent = pagecontent .. '\n\n'
    pagecontent = pagecontent .. '== Weblinks ==\n\n'
    pagecontent = pagecontent .. '* ' .. utils.renderTemplate('Navigium', {basicM}) .. '\n'
    pagecontent = pagecontent .. '* ' .. utils.renderTemplate('Georges', {basicM}) .. '\n'
    pagecontent = pagecontent .. '[[Kategorie:Substantiv (Latein)/' .. basicM:sub(1,1) .. ']]\n'
    pagecontent = pagecontent .. utils.addCampusCategoryIfSet(lekt)
	return pagecontent
end

return p