Module:TemplateExists

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:TemplateExists/doc

local p = {}

function p.main()
    local title = mw.title.getCurrentTitle()
    local content = mw.title.new(title.prefixedText):getContent()

    if string.find(content, "{{PhantomBlood}}") then
        return "PB"
    end

    if string.find(content, "{{BattleTendency}}") then
        return "BT"
    end

    if string.find(content, "{{StardustCrusaders}}") then
        return "SC"
    end
    
    if string.find(content, "{{DiamondisUnbreakable}}") then
        return "DU"
    end
    
    if string.find(content, "{{VentoAureo}}") then
        return "VA"
    end
    
    if string.find(content, "{{StoneOcean}}") then
        return "SO"
    end
    
    if string.find(content, "{{SteelBallRun}}") then
        return "SBR"
    end

    if string.find(content, "{{JoJolion}}") then
        return "JJL"
    end

    if string.find(content, "{{TheJOJOLands}}") then
        return "TJL"
    end
    
    if string.find(content, "{{ThusSpokeKishibeRohan}}") then
        return "TSKR"
    end

    -- Return an empty string if none of the templates is found
    return ""
end

return p