Module:PrevNext

local p = {};

p.prev = function (frame) ep = frame.args[1] currentEp = current(ep) prefix, epNum = parseCode(currentEp) local prevNum = string.format("%02d", epNum - 1) local prevCode = prefix .. 'x' .. prevNum return prevCode end

p.next = function (frame) ep = frame.args[1] currentEp = current(ep) prefix, epNum = parseCode(currentEp) local nextNum = string.format("%02d", epNum + 1) local nextCode = prefix .. 'x' .. nextNum return nextCode end

current = function (ep) local epCall = require('Module:Ep/Matcher') local epCode = epCall.matchCode(ep) return epCode end

parseCode = function (epCode) local epInfos = require('Module:Ep/Info') local prefix, epNum = epInfos.parseCode(epCode) return prefix, epNum end

return p