Module:GetEmoji: Difference between revisions
From Heterodontosaurus Balls
Replaced content with "--[[ This module is intended to provide an alt text (text that appears when the image doesn't load or is copied to a plaintext editor) for the image on {{I}}, and to provide an appropriate link to the character when the image is clicked. But it is not in use because for some reason Navbox/EU and Navbox/Germany (and the pages that uses them) crashes when the appropriate version of {{I}} is implemented. ]] local p = {} --[[ This table provides the alt text and link..." Tag: Replaced |
No edit summary |
||
| Line 1: | Line 1: | ||
--[[ | --[[ | ||
This module makes icons using {{I}} display 🟢 when copied as text. | |||
]] | ]] | ||
local p = {} | local p = {} | ||
local codes = { | local codes = { | ||
} | } | ||
function p.code( frame ) | function p.code( frame ) | ||
| Line 86: | Line 26: | ||
end | end | ||
end | end | ||
-- If code is not found, return " | -- If code is not found, return "🟢" as the fallback | ||
return " | return "🟢" | ||
end | end | ||
return p | return p | ||
Latest revision as of 19:20, 9 July 2026
Documentation for this module may be created at Module:GetEmoji/doc
--[[
This module makes icons using {{I}} display 🟢 when copied as text.
]]
local p = {}
local codes = {
}
function p.code( frame )
c = mw.text.trim(frame.args[1])
for i, a in ipairs(codes) do
if a[1] == c then
if frame.args[2] == "alt" then
-- Return alt text if specified
if a[2] then
return a[2]
else
return "(Icon)" -- If no alt text is specified, return "(Icon)"
end
else
-- Return the link destination (if available)
return a[3] or c -- If no link destination, return the code itself
end
end
end
-- If code is not found, return "🟢" as the fallback
return "🟢"
end
return p
