Module:PartVariables
Jump to navigation
Jump to search
Documentation for this module may be created at Module:PartVariables/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",
VA = "Vento Aureo",
SO = "Stone Ocean",
SBR = "Steel Ball Run",
JJL = "JoJolion",
TJL = "The JOJOLands",
TSKR = "Thus Spoke Kishibe Rohan",
CDDH = "Crazy Diamond's Demonic Heartbreak",
Baoh = "Baoh the Visitor",
["JORGE JOESTAR"] = "JORGE JOESTAR",
CSBT = "Cool Shock B.T.",
["Cool Shock Old B.T."] = "Cool Shock Old B.T.",
CSOBT = "Cool Shock Old B.T.",
["Gorgeous Irene"] = "Gorgeous Irene",
Eccentrics = "The Lives of Eccentrics",
["Purple Haze Feedback"] = "Purple Haze Feedback",
["The Book"] = "The Book jojo's bizarre adventure 4th another day",
["Crazy Heartbreakers"] = "Crazy Heartbreakers",
["rey infinito"] = "rey infinito",
ASBR = "All-Star Battle R",
EoH = "Eyes of Heaven",
ASB = "All-Star Battle"
}
-- Special Cases
-- Pattern to detect "Chapter X" format
local chapterPattern = "(%a+) Chapter (%d+)"
local abbreviation, chapterNumber = string.match(input, chapterPattern)
if abbreviation and abbreviations[abbreviation] then
-- Special handling for "CDDH" to ignore "Chapter X"
if abbreviation == "CDDH" then
return "''[[" .. abbreviations[abbreviation] .. "]]'': [[" .. abbreviation .. " Chapter " .. chapterNumber .. "|Chapter " .. chapterNumber .. "]]"
else
-- JORGE
if abbreviation == "JORGE JOESTAR" then
return "''[[JORGE JOESTAR (Novel)|JORGE JOESTAR]]'' " .. string.sub(input, #abbreviation + 2)
else
return "''[[" .. abbreviations[abbreviation] .. "]]'' " .. string.sub(input, #abbreviation + 2)
end
end
end
return input
end
return p