8,756
edits
(if text is empty return just blank) |
(fixed bug with colored spaces not showing up properly) |
||
Line 53: | Line 53: | ||
local b = normalize(frame.args[1],regextype) | local b = normalize(frame.args[1],regextype) | ||
local a = string.gsub(b, regex, function(_,color,space1,text) | local a = string.gsub(b, regex, function(_,color,space1,text) | ||
space1 = space1 or "" | space1 = space1 or "" | ||
text = text or "" | if text ~= nil and text ~= '' then | ||
local hexcolor = luatable[color] | |||
if hexcolor == nil then | |||
error ("There was no specified color for color code: " .. color) | |||
end | |||
text = text or "" | |||
return space1 .. "<span style=\"color: " .. hexcolor .. ";\">" .. text .. "</span>" | |||
else | else | ||
return space1 | |||
end | end | ||
end) | end) |