Module:Episode Guide

local p = {}

function p.peanuts(frame) local tArgs = frame:getParent if not(tArgs.args[1]) then tArgs = frame end local result result = '' title = '' user = '' ytuser = 'UC_ufxdQbKBrrMOiZ4LzrUyA' collapse = 'mw-collapsed' dash = '' for key, value in pairs(tArgs.args) do       editedvalue = string.gsub(string.gsub(value, "\n", "")," ","") if (tonumber(key) ~= nil) then if (key % 2 == 1) then result = result .. '|-\n! style="text-align:left;font-weight:normal;padding-left:5px" |' .. string.gsub(string.gsub(value, "\\", "&#124;"),"!","&#33;") .. '\n' else if (string.len(editedvalue) ~= 11) then return ' Error! Please check that you have used the template right by checking the documentation here. ' ..                    'Reason: This is meant to be an 11 character YouTube link. There was an error at [' .. key .. ']: ' .. value .. ' '               end result = result .. '| style="text-align:center" |[https://www.youtube.com/watch?v=' .. editedvalue .. ' Watch]\n' end elseif (key == 'user') then user = value elseif (key == 'title') then title = value elseif (key == 'ytuser') then ytuser = value elseif (key == 'collapse') then if (editedvalue == '1') then collapse = '' end else return ' Error! Please check that you have used the template right by checking the documentation here. ' ..            'Reason: Unknown key (|randomname=). There was an error at [' .. key .. ']: ' .. value .. ' '       end end if (title ~=  and user ~= ) then dash = ' — ' end return '{| class="wikitable mw-collapsible ' .. collapse .. ' episodeguide" style="width:100%;clear:both;"' .. '\n' .. '!style="padding:10px;text-align:left;" colspan="4"|' .. user .. dash .. title .. '\n' .. '|-\n' .. '! width="85%" style="padding:10px;text-align:left" |Video Name\n' .. '! width="15%" style="text-align:center" |\n' .. '|-\n' .. result .. '|}' end

return p