Module:Soreness
From Growtopia
Documentation for this module may be created at Module:Soreness/doc
local p = {}
function p.test(frame)
-- Ensure 'class' is initialized as a table
local class = {}
table.insert(class, "growsprite")
-- Get the input argument
local newwidth = frame.args[2] or "32" -- Default to an empty string if not provided
local rawInput = frame.args[1] or "[[File:Bingo_Card.png]]"
-- Preprocess the rawInput to convert wikitext into HTML
local input = frame:preprocess(rawInput)
local href = input:match('<a%s+[^>]*href="([^"]+)"')
if not href then
return "Error: Unable to find 'href' in the input."
end
local strippedHref = href:match("^(.-)/revision")
if not strippedHref then
return "Error: Unable to strip 'href' at '/revision'."
end
-- Construct the desired <img> tag
local imgTag = input..'/revision/latest/scale-to-width-down/scale-to-width-down/'..newwidth
local imgTagOld = 'https://static.wikia.nocookie.net/growtopia/images/6/6c/'..input..'/revision/latest/scale-to-width-down/'..newwidth
-- Construct the final output with the growsprite span
return "<span class='" .. table.concat(class, " ") .. "'>" .. imgTag .. "</span>[[Category:AutoPurge]]"
end
return p