1,124
edits
Line 27: | Line 27: | ||
resource = string.lower(trim(resource)) | resource = string.lower(trim(resource)) | ||
resource = iconList[resource] | resource = iconList[resource] | ||
if resource ~= nil then | if resource ~= nil then | ||
Line 35: | Line 34: | ||
end | end | ||
result = '[[file:' .. resource['file'] .. '|16px|link=' | --No point trimming the value if it won't be used | ||
value = trim(value) | |||
--Check after trim as may be whitespace only | |||
if exists(value) == true then | |||
value = ' (' .. value .. ')' | |||
end | |||
result = '[[file:' | |||
.. resource['file'] | |||
.. '|16px|link=' | |||
.. link | |||
.. ']]' | |||
if exists(text) == true then | if exists(text) == true then | ||
if string.lower(text) ~= 'no' then | if string.lower(text) ~= 'no' then | ||
result = result .. '[[' | result = result .. '[[' | ||
.. link | |||
.. ']]' | |||
end | end | ||
end | end | ||
else | else | ||
result = 'Icon does not exist[[Category:Missing Icon]]' | result = 'Icon does not exist[[Category:Missing Icon]]' |