Module:MKWorld missions
From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
This module outputs the {{MKWorld missions}} table with data from here.
local MISSIONS = mw.loadJsonData('Module:MKWorld missions/data.json')
local tables = require('Module:Table')
local p = {}
function p.main(frame)
local args = frame:getParent().args
local current_title = string.lower(mw.title.getCurrentTitle().text)
local wikitext = '{|class="wikitable '
if args[2] then
wikitext = wikitext .. "sortable "
end
wikitext = wikitext .. 'col5left spinoff mk" style="width:100%;text-align:center"\n'
wikitext = wikitext .. '!width="10%" class="unsortable"|Image\n'
wikitext = wikitext .. '!width="15%"|In-game text\n'
wikitext = wikitext .. '!width="10%"|Location\n'
wikitext = wikitext .. '!width="5%"|Time limit (seconds)\n'
wikitext = wikitext .. '!width="50%" class="unsortable"|Description\n'
wikitext = wikitext .. '!width="10%" class="unsortable"|Sticker\n'
local link_tracker = tables.LinkTracker.new(current_title)
for k, v in ipairs(args) do
v = tables.trim(v)
if v ~= "" then
wikitext = wikitext .. frame:preprocess("|-{{anchor|" .. v .. "}}\n")
local mission = MISSIONS[v]
if mission == nil then
error("Mission parameter " .. k .. " is invalid: " .. v)
else
wikitext = wikitext .. "|" .. frame:preprocess(mission.image or tables.noimage("MKWorld Mission " .. v)) .. "\n"
wikitext = wikitext .. "|''" .. v .. "''\n"
wikitext = wikitext .. "|" .. frame:preprocess(mission.location or "") .. "\n"
wikitext = wikitext .. "|" .. frame:preprocess(mission.time or "") .. "\n"
wikitext = wikitext .. "|" .. frame:preprocess(link_tracker:parse(mission.desc)) .. "\n"
wikitext = wikitext .. "|" .. frame:preprocess(mission.sticker or "") .. "\n"
end
end
end
wikitext = wikitext .. "|}"
return wikitext
end
return p