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 12: | Line 12: | ||
item = 'help', | item = 'help', | ||
wp = 'whisper', | wp = 'whisper', | ||
} | } | ||
| Line 35: | Line 24: | ||
catch = 'text-catch', | catch = 'text-catch', | ||
whisper = 'text-whisper', | whisper = 'text-whisper', | ||
} | } | ||
| Line 75: | Line 59: | ||
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 89: | ||
-- 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 | ||