Module:SeasonVariables

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 17:42, 25 April 2024 by HudgynS (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

local p = {}

function p.main(frame)
    local input = frame.args[1]
    local abbreviations = {
        PB = "Phantom Blood",
        BT = "Battle Tendency",
        SC = "Stardust Crusaders",
        DU = "Diamond is Unbreakable",
        GW = "Golden Wind",
        SO = "Stone Ocean",
        SBR = "Steel Ball Run",
        JJL = "JoJolion",
        TJL = "The JOJOLands"
    }
    for abbreviation, full_name in pairs(abbreviations) do
        if not string.find(input, "(%w+) Episode") then
        	if string.find(input, "(OVA)") then
        		return "''[[JoJo's Bizarre Adventure (OVA)|JoJo's Bizarre Adventure]]'' Episode " .. string.sub(input, string.len("Episode") + 2)
        	else
        		return "''[[JoJo's Bizarre Adventure (Season)|JoJo's Bizarre Adventure]]'' Episode " .. string.sub(input, string.len("Episode") + 2)
        	end
        elseif string.find(input, abbreviation) then
        	return "''[[" .. full_name .. " (Anime)|" .. full_name .. "]]'' " .. string.sub(input, string.len(abbreviation) + 2)
        elseif string.find(input, "TSKR") then
            if string.find(input, "(TV Drama)") then
        	    return "''[[Thus Spoke Kishibe Rohan (TV Drama)|Thus Spoke Kishibe Rohan]]'' Episode " .. string.sub(input, string.len("TSKR Episode") + 2)
            else
        	    return "''[[Thus Spoke Kishibe Rohan (OVA)|Thus Spoke Kishibe Rohan]]'' Episode " .. string.sub(input, string.len("TSKR Episode") + 2)
            end
        end
    end
    return input
end

return p