Modul:LateinUtils: Unterschied zwischen den Versionen
Aus KGS-Wiki
Sn (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Sn (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
Zeile 131: | Zeile 131: | ||
} | } | ||
function p.renderFT(wortart, formen | function p.renderFT(wortart, formen, additionalParams) | ||
if mw.isSubsting() then | if mw.isSubsting() then | ||
local formentabelle = '{{Formentabelle/' .. wortart | local formentabelle = '{{Formentabelle/' .. wortart | ||
Zeile 151: | Zeile 151: | ||
formen[k] = v | formen[k] = v | ||
end | end | ||
return | return p.renderTemplate('Formentabelle/' .. wortart, formen) | ||
end | end | ||
end | end |
Aktuelle Version vom 17. Oktober 2024, 14:56 Uhr
Die Dokumentation für dieses Modul kann unter Modul:LateinUtils/Doku erstellt werden
local p = {}
p.KASUS = {'Nominativ', 'Genitiv', 'Dativ', 'Akkusativ', 'Ablativ', 'Vokativ'}
p.NUMERI = {S = 'Singular', P = 'Plural'}
p.NABBRV = {S = 'Sg.', P = 'Pl.'}
p.STUFEN = {p = "[[Positiv (Steigerungsform)|]]", k = "[[Komparativ]]", s = "[[Superlativ]]"}
p.GENERA = {m = 'maskulinum', f = 'femininum', n = 'neutrum'}
p.KONS = 'bcdfghlmnpqrstvx'
p.DEKLS = {
o = {
m = {
S = {'', 'i', 'o', 'um', 'o', 'e'};
P = {'i', 'orum', 'is', 'os', 'is'}
};
f = {
S = {'', 'i', 'o', 'um', 'o'};
P = {'i', 'orum', 'is', 'os', 'is'}
};
n = {
S = {'', 'i', 'o', 'um', 'o'};
P = {'a', 'orum', 'is', 'a', 'is'}
};
name = 'o-Deklination'
};
a = {
m = {
S = {'', 'ae', 'ae', 'am', 'ā'};
P = {'ae', 'arum', 'is', 'as', 'is'}
};
f = {
S = {'', 'ae', 'ae', 'am', 'ā'};
P = {'ae', 'arum', 'is', 'as', 'is'}
};
n = {
S = {'', 'ae', 'ae', 'am', 'ā'};
P = {'ae', 'arum', 'is', 'as', 'is'}
};
name = 'a-Deklination'
};
k = {
m = {
S = {'', 'is', 'i', 'em', 'e'};
P = {'es', 'um', 'ibus', 'es', 'ibus'}
};
f = {
S = {'', 'is', 'i', 'em', 'e'};
P = {'es', 'um', 'ibus', 'es', 'ibus'}
};
n = {
S = {'', 'is', 'i', 'em', 'e'};
P = {'a', 'um', 'ibus', 'a', 'ibus'}
};
name = '3. Deklination'
};
e = {
m = {
S = {'', 'ei', 'ei', 'em', 'e'};
P = {'es', 'erum', 'ebus', 'es', 'ebus'}
};
f = {
S = {'', 'ei', 'ei', 'em', 'e'};
P = {'es', 'erum', 'ebus', 'es', 'ebus'}
};
n = {
S = {'', 'ei', 'ei', 'em', 'e'};
P = {'es', 'erum', 'ebus', 'es', 'ebus'}
};
name = 'e-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 = 'i-Deklination'
};
u = {
m = {
S = {'', 'ūs', 'ui', 'um', 'u'};
P = {'ūs', 'uum', 'ibus', 'ūs', 'ibus'}
};
f = {
S = {'', 'ūs', 'ui', 'um', 'u'};
P = {'ūs', 'uum', 'ibus', 'ūs', 'ibus'}
};
n = {
S = {'', 'ūs', 'ui', 'u', 'u'};
P = {'ua', 'uum', 'ibus', 'ua', 'ibus'}
};
name = 'u-Deklination'
}
}
p.FT_PARAM_ORDER = {
Substantiv = {
{'S1', 'P1'};
{'S2', 'P2'};
{'S3', 'P3'};
{'S4', 'P4'};
{'S5', 'P5'};
{'S6'}
};
Adjektiv = {
{'S1m', 'S1f', 'S1n'};
{'S2m', 'S2f', 'S2n'};
{'S3m', 'S3f', 'S3n'};
{'S4m', 'S4f', 'S4n'};
{'S5m', 'S5f', 'S5n'};
{'S6m'};
{'P1m', 'P1f', 'P1n'};
{'P2m', 'P2f', 'P2n'};
{'P3m', 'P3f', 'P3n'};
{'P4m', 'P4f', 'P4n'};
{'P5m', 'P5f', 'P5n'};
};
Verb = {
{'1SIA', '1SIP', '1SKA', '1SKP'};
{'2SIA', '2SIP', '2SKA', '2SKP', 'ImpS'};
{'3SIA', '3SIP', '3SKA', '3SKP'};
{'1PIA', '1PIP', '1PKA', '1PKP'};
{'2PIA', '2PIP', '2PKA', '2PKP', 'ImpP'};
{'3PIA', '3PIP', '3PKA', '3PKP'};
}
}
function p.renderFT(wortart, formen, additionalParams)
if mw.isSubsting() then
local formentabelle = '{{Formentabelle/' .. wortart
for k,v in pairs(additionalParams) do
formentabelle = formentabelle .. '|' .. k .. '=' .. v
end
for _, zeile in pairs(p.FT_PARAM_ORDER[wortart]) do
formentabelle = formentabelle .. '\n'
for _,zelle in pairs(zeile) do
if formen[zelle] then
formentabelle = formentabelle .. '|' .. zelle .. '=' .. formen[zelle]
end
end
end
formentabelle = formentabelle .. '}}\n\n'
return formentabelle
else
for k,v in pairs(additionalParams) do
formen[k] = v
end
return p.renderTemplate('Formentabelle/' .. wortart, formen)
end
end
function p.renderTemplate(name, params)
local frame = mw.getCurrentFrame()
local templateText
if mw.isSubsting() then
templateText = '{{' .. name
for k,v in pairs(params) do
templateText = templateText .. '|' .. k .. '=' .. v
end
templateText = templateText .. '}}'
else
templateText = frame:expandTemplate{title=name, args=params}
end
return templateText
end
function p.enclose(text)
return tostring(mw.html.create('span'):attr('lang', 'la'):wikitext(text))
end
function p.setIfPossible(maybeArray,index,value)
if maybeArray then
maybeArray[index] = value
end
end
function p.addCampusCategoryIfSet(lesson)
if lesson and tonumber(lesson) ~= 0 and lesson ~= '' then
return '[[Kategorie:Campus Lektion ' .. lesson .. ']]\n'
end
return ''
end
function p.parseArray(frame)
res = {}
for k, v in string.gmatch(frame.args[1], "([^,]+):([^,]+)") do
res[k] = v
end
return mw.af.export(res)
end
function p.renderLernformen(formen, erklaerung)
local innerDiv = mw.html.create('div')
:addClass('mw-collapsible-content')
:wikitext(erklaerung)
local outerDiv = mw.html.create('div')
:addClass('mw-collapsible')
:addClass('mw-collapsed')
:css('display','table;')
:attr('data-expandtext', 'Was heißt das?')
:attr('data-collapsetext', 'Erklärung verbergen')
:wikitext(formen .. ' ' .. tostring(innerDiv))
return tostring(outerDiv)
end
function p.renderVokabelbox(templatename, lernformen)
return p.renderTemplate('Vokabelbox', {
Lernformen = p.renderTemplate(templatename, lernformen);
Bedeutungen = '';
Aufbau = '';
Wendungen = '';
Verwandte = '';
AndereSprachen = ''
}):gsub('|','\n|')
end
function p.renderWortwolke(grundform)
return p.renderTemplate("Thumbnailbox", {INHALT = p.renderTemplate("Wortwolke", {grundform, ""})})
end
function p.renderFooter(navigium, georges, lektionen)
local pagecontent = ""
pagecontent = pagecontent .. "\n\n== Weblinks ==\n\n"
pagecontent = pagecontent .. "* " .. p.renderTemplate('Navigium', {navigium}) .. "\n"
pagecontent = pagecontent .. "* " .. p.renderTemplate("Georges", {georges}) .. "\n"
pagecontent = pagecontent .. p.renderTemplate("Vokabel-Kategorien", {table.concat(lektionen,",")})
return pagecontent
end
return p