Module:Source medium

local textUtil = require('Module:TextUtil') local p = {}

function p.getMedium(frame) local pageName = frame.args[1] local dab = textUtil.split(textUtil.split(string.gsub(pageName, "%)", ""), "(", true)[2], " ", true) if dab[#dab] == "story" then if dab[#dab-1] == "short" then return "short story" else return dab[#dab-1] end elseif dab[#dab] == "webcast" or dab[#dab] == "feature" or dab[#dab] == "script" or dab[#dab] == "illustration" or dab[#dab] == "poem" then return dab[#dab] elseif dab[#dab] == "novel" or dab[#dab] == "novelisation" then return "novel" elseif dab[#dab] == "video" then return "home video" elseif dab[#dab] == "game" then if dab[#dab-1] == "video" then return "video game" elseif dab[#dab-1] == "escape" then return "escape game" else return "game" end elseif dab[#dab] == "play" then return "stage play" elseif dab[#dab] == "film" then return "theatrical film" else return textUtil.split(string.gsub(pageName, "%)", ""), "(", true)[2] end end

return p