FANDOM


local p = {}
 
local title = mw.title.getCurrentTitle()
local number = 1
local thing = "Hello"
 
function p.main()
    thing = "Apparently not"
end
 
function p.title()
    return title.text
end
 
local function number( number )
    number = number + 1
    return number
end
 
function p.getThing( frame )
    return frame:getTitle()
end
 
function p.testContent()
    return p._testContent()
end
 
function p._testContent()
    local content = title:getContent()
    -- true if test template is used, false otherwise
    return content:find( "{{Test}}" ) ~= nil
end
 
function p.switchingTabs( frame )
    local epNum = frame:expandTemplate{ title = "TabSwitch", args = { frame.args[1] } }
    -- check if it is a number
    if tonumber(epNum) then
        return frame:expandTemplate{ title = "TabSwitch", args = { epNum + 1 } }
    else
        return "N/A"
    end
end
 
function p.testFind()
    return string.sub( "test", -1 )
    --[[
    local string = "IWantCookies"
    local location = string.find( string, "Waffles" )
    if location then
        return string.sub( string, 1, string.find( string, "Waffles" ) - 1 )
    else
        return string
    end
    ]]--
end
 
function p.categorytree( frame )
    local categoryPages = frame:preprocess( [[<categorytree mode=pages namespaces=-
        hideroot=on>I Just Like Categories</categorytree>]] )
    local pageList = table.concat( mw.text.split( categoryPages, '\n' ), ',')
    return frame:preprocess( '<nowiki>' .. pageList .. '</nowiki>' )
end
 
function p.api()
    return mw.uri.new('http://steven-universe.wikia.com/api.php?action=query&list=categorymembers&cmtitle=category:episodes&limit=500&format=json').user
end
 
return p