Editing Module:Color
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 5: | Line 5: | ||
bz = 'buzz', | bz = 'buzz', | ||
buzzword = 'buzz', | buzzword = 'buzz', | ||
event = 'bp', | |||
action = 'menu', | |||
tutorial = 'help' | |||
tutorial = 'help | |||
} | } | ||
local colors = { | local colors = { | ||
buzz = 'text-buzz', | buzz = 'text-buzz', | ||
bp = 'text-bp', | |||
menu = 'text-menu', | menu = 'text-menu', | ||
new = 'text-new', | new = 'text-new', | ||
| Line 34: | Line 18: | ||
help = 'text-help', | help = 'text-help', | ||
catch = 'text-catch', | catch = 'text-catch', | ||
} | } | ||
| Line 75: | Line 53: | ||
end | end | ||
if (args. | if (args.nobold and lib.isNotEmpty(class)) then | ||
return '<span class="' .. class .. '">' .. text .. '</span>' | return '<span class="' .. class .. '">' .. text .. '</span>' | ||
elseif (args. | elseif (args.nobold and lib.isNotEmpty(span)) then | ||
return '<span style="color:' .. span .. '">' .. text .. '</span>' | return '<span style="color:' .. span .. '">' .. text .. '</span>' | ||
elseif lib.isNotEmpty(span) then | elseif lib.isNotEmpty(span) then | ||
| Line 105: | Line 83: | ||
-- Helper method to search given text for the keys of given table t. | -- Helper method to search given text for the keys of given table t. | ||
-- If a key is found, returns its value; returns nil otherwise. | -- If a key is found, returns its value; returns nil otherwise. | ||
local function searchTextForKeys(text, t) | local function searchTextForKeys(text, t) | ||
for key, val in pairs(t) do | |||
result = mw.ustring.find(text, key, 1, true) | |||
if result ~= nil then return val end | |||
end | end | ||
end | end | ||