Module:MediumLink

local p = {}

local function getArgs(frame) local args = {} for key, value in pairs(frame:getParent.args) do       args[key] = value end for key, value in pairs(frame.args) do       args[key] = value end return args end

function p.main(frame) local args       = getArgs(frame) local medium     = args.medium or '' local link       = args.link or '' local short      = args.short or '' local shorter    = args.shorter or '' local shortest   = args.shortest or '' local mode1      = args[1] or args.mode1 or '' local mode2      = args[2] or args.mode2 or '' local mode3      = args[3] or args.mode3 or '' return p.outputMediumLink(medium, link, short, shorter, shortest, mode1, mode2, mode3) end

function p.outputMediumLink(medium, link, short, shorter, shortest, mode1, mode2, mode3) local function isEmpty(s) return s == nil or s == '' end local print = '' local linkindicator = '' if medium == "Gekijōban Doubutsu no Mori" then linkindicator = "🎬 " end local error = '\'\'\' Invalid parameters detected! Did you entered the wrong parameters or are the parameters needed to generate this link empty? \'\'\''	if not isEmpty(mode1) then if mode1 == "nolink" then if not isEmpty(short) and mode2 == "short" then if mode3 == "sm" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then print = "''" .. short .. "''"				else print = error end elseif not isEmpty(shorter) and mode2 == "shorter" then if mode3 == "sm" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then print = shorter else print = error end elseif not isEmpty(shortest) and mode2 == "shortest" then if mode3 == "sm" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = shortest else print = error end elseif mode2 == "sm" then if not isEmpty(short) and mode3 == "short" then print = " ''" .. short .. "'' "				elseif not isEmpty(shorter) and mode3 == "shorter" then print = " " .. shorter .. " "				elseif not isEmpty(shortest) and mode3 == "shortest" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = " ''" .. medium .. "'' "				else print = error end elseif isEmpty(mode2) then print = "''" .. medium .. "''"			else print = error end elseif not isEmpty(short) and mode1 == "short" then if mode2 == "nolink" then if mode3 == "sm" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then print = "''" .. short .. "''"				else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. short .. " " else print = " " .. linkindicator .. "" .. short .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = "" .. linkindicator .. "" .. short .. "" else print = "" .. linkindicator .. "" .. short .. "" end else print = error end elseif not isEmpty(shorter) and mode1 == "shorter" then if mode2 == "nolink" then if mode3 == "sm" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then print = shorter else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shorter .. " " else print = " " .. linkindicator .. shorter .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = "" .. linkindicator .. shorter .. "" else print = "" .. linkindicator .. shorter .. "" end else print = error end elseif not isEmpty(shortest) and mode1 == "shortest" then if mode2 == "nolink" then if mode3 == "sm" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = shortest else print = error end elseif mode2 == "sm" then if mode3 == "nolink" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shortest .. " " else print = " " .. linkindicator .. shortest .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = "" .. linkindicator .. shortest .. "" else print = "" .. linkindicator .. shortest .. "" end else print = error end elseif mode1 == "sm" then if mode2 == "nolink" then if not isEmpty(short) and mode3 == "short" then print = " ''" .. short .. "'' "				elseif not isEmpty(shorter) and mode3 == "shorter" then print = " " .. shorter .. " "				elseif not isEmpty(shortest) and mode3 == "shortest" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then print = " ''" .. medium .. "'' "				else print = error end elseif not isEmpty(short) and mode2 == "short" then if mode3 == "nolink" then print = " ''" .. short .. "'' "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. short .. " " else print = " " .. linkindicator .. "" .. short .. " " end else print = error end elseif not isEmpty(shorter) and mode2 == "shorter" then if mode3 == "nolink" then print = " " .. shorter .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shorter .. " " else print = " " .. linkindicator .. shorter .. " " end else print = error end elseif not isEmpty(shortest) and mode2 == "shortest" then if mode3 == "nolink" then print = " " .. shortest .. " "				elseif isEmpty(mode3) then if not isEmpty(link) then print = " " .. linkindicator .. shortest .. " " else print = " " .. linkindicator .. shortest .. " " end else print = error end elseif isEmpty(mode2) then if not isEmpty(link) then print = " " .. linkindicator .. "" .. medium .. " " elseif not isEmpty(linkindicator) then print = " " .. linkindicator .. "" .. medium .. " " else print = " " .. medium .. " " end else print = error end else print = error end elseif isEmpty(mode1) then if not isEmpty(link) then print = "" .. linkindicator .. "" .. medium .. "" elseif not isEmpty(linkindicator) then print = "" .. linkindicator .. "" .. medium .. "" else print = "" .. medium .. "" end else print = error end return print end

return p