Documentation for this module may be created at Module:Episode/doc
local p = {}
local data = mw.loadData('Module:Episode/data')
function p.link(frame)
local args = frame.args
local episode = mw.title.getCurrentTitle().text
if args[2] ~= nil and args[2] ~= "" then
episode = args[2]
end
local dir = tonumber(args[1])
local function ret(current)
if current ~= nul then
if mw.ustring.find(current, "(", 0, true) then
return "\"[[" .. current .. "|" .. mw.ustring.sub(current, 0, mw.ustring.find(current, "(", 0, true) - 2) .. "]]\""
else
return "\"[[" .. current .. "]]\""
end
else
return "—"
end
end
for i, v in ipairs(data) do
if v == episode then
return ret(data[i + dir])
end
end
end
function p.overall()
local episode = mw.title.getCurrentTitle().text
for i, v in ipairs(data) do
if v == episode then
if i == 91 then
return i .. "/" .. i + 1
end
if 91 < i then
i = i + 1
end
if i == 111 then
return i .. "/" .. i + 1
end
if 111 < i then
i = i + 1
end
if i == 124 then
return i .. "/" .. i + 1
end
return i
end
end
end
return p