FANDOM


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, "\\", "|"),"!","!") .. '\n'
            else
                if (string.len(editedvalue) ~= 11) then
                    return '<div style="color:#F00"><b>Error!</b> Please check that you have used [[Template:Episodes2|the template right by checking the documentation here]].<br/>' .. 
                    'Reason: This is meant to be an 11 character YouTube link. There was an error at [' .. key .. ']: ' .. value .. 
                    '</div>'
                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 '<div style="color:#F00"><b>Error!</b> Please check that you have used [[Template:Episodes2|the template right by checking the documentation here]].<br/>' .. 
            'Reason: Unknown key (|randomname=). There was an error at [' .. key .. ']: ' .. value .. 
            '</div>'
        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" |[[File:Table yt.png|130px|link=https://www.youtube.com/channel/' .. ytuser .. ']]\n' ..
    '|-\n' ..
    result .. '|}'
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.