Module:ItemEffect
From He is Coming Official Wiki
Documentation for this module may be created at Module:ItemEffect/doc
local p = {}
function p.main(frame)
local item = frame.args[1] or ""
if item == "" then
return "No item specified"
end
-- Normalize item name (replace spaces with underscores)
local safeItem = item:gsub(" ", "_")
-- Build effect page title
local effectPage = mw.title.new("He_is_Coming/" .. safeItem .. "/effect")
if not effectPage or not effectPage.exists then
return "Effect page not found"
end
-- Get the raw wikitext of the effect page
local effectText = effectPage:getContent() or ""
-- Get ColorText module
local ColorText = mw.getContentModule("ColorText")
if not ColorText or not ColorText.colors then
return effectText -- fallback: no coloring if ColorText missing
end
-- Replace all keywords dynamically
for keyword, _ in pairs(ColorText.colors) do
local colored = ColorText.main{args={keyword}}
-- Replace whole words only, case-insensitive
effectText = effectText:gsub("(%f[%w])"..keyword.."(%f[%W])", colored)
end
return effectText
end
return p


