Die Dokumentation für dieses Modul kann unter Modul:Serie/Doku erstellt werden
local p = {}
local serie = {
["1"] = { titel = "Professor Layton und das geheimnisvolle Dorf", kurz = "Das geheimnisvolle Dorf" },
["2"] = { titel = "Professor Layton und die Schatulle der Pandora", kurz = "Die Schatulle der Pandora"},
["3"] = { titel = "Professor Layton und die verlorene Zukunft", kurz = "Die verlorene Zukunft"},
["4"] = { titel = "Professor Layton und der Ruf des Phantoms", kurz = "Der Ruf des Phantoms"},
["5"] = { titel = "Professor Layton und die Maske der Wunder", kurz = "Die Maske der Wunder"},
["6"] = { titel = "Professor Layton und das Vermächtnis von Aslant", kurz = "Das Vermächtnis von Aslant" },
["VS"] = { titel = "Professor Layton vs. Phoenix Wright: Ace Attorney", kurz = "Layton vs. Ace Attorney" },
["MJ"] = { titel = "Layton’s Mystery Journey: Katrielle und die Verschwörung der Millionäre", kurz = "Layton’s Mystery Journey" },
["ED"] = { titel = "Professor Layton und die ewige Diva", kurz = "Die ewige Diva" },
["DL"] = { titel = "Detektei Layton – Katrielles rätselhafte Fälle", kurz = "Detektei Layton" },
["LBMR"] = { titel = "Layton Brothers: Mystery Room", kurz = "Layton Brothers" },
["Shikyo"] = { titel = "Layton Kyōju to Shikyo no Kan", kurz = "Shikyo no Kan" }
}
local function getEintrag(code)
-- Varianten
-- Layton's Mystery Journey
if code == "7" or code == "LMJ" then code = "MJ" end
return serie[code]
end
local function makeLink(page, text)
if text then text = "|" .. text else text = "" end
return "[[" .. page .. text .. "]]"
end
local function errMsgCodeFalsch(code)
return "<span style=\"font-weight: bold; color: #FE2E2E\" >[[Vorlage:Serie]] meldet: Ungültiger Spielecode \"" .. code .. "\" angegeben</span>"
end
function p.Titel(frame)
local args = frame:getParent().args
local eintrag = getEintrag(args[1])
if not eintrag then return errMsgCodeFalsch(args[1]) end
local kurz = args[2] == "kurz" or args[3] == "kurz"
local link = args[2] ~= "text" and args[3] ~= "text"
local text = eintrag.titel
if kurz then
text = eintrag.kurz
end
if link then
return makeLink(eintrag.titel, text)
else
return text
end
end
function p.Infobox(frame)
local args = frame:getParent().args
local eintrag
local liste = ""
for code in mw.text.gsplit(args[1], ',', true) do
eintrag = getEintrag(code)
if not eintrag then
liste = liste .. errMsgCodeFalsch(code) .. "<br />"
else
liste = liste .. "[[" .. eintrag.titel .. "|" .. eintrag.kurz .. "]]<br />"
end
end
return mw.text.trim(liste, "<br />")
end
function p.Main(frame)
local args = frame:getParent().args
if args[2] and string.lower(args[2]) == "infobox" then
return p.Infobox(frame)
else
return p.Titel(frame)
end
end
return p