Difference between revisions of "Module:Icon"

Jump to navigation Jump to search
6 bytes added ,  19:50, 23 October 2021
no edit summary
Line 27: Line 27:
resource = string.lower(trim(resource))
resource = string.lower(trim(resource))
resource = iconList[resource]
resource = iconList[resource]
value = trim(value)
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
result = result .. link
value = trim(value)
result = result .. ']]'
--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 .. '[['
result = result .. link
.. link
result = result .. resource['link']
.. ']]'
result = result .. ']]'
end
end
end
end
if exists(value) == true then
result = result .. ' (' .. value .. ')'
end
else
else
result = 'Icon does not exist[[Category:Missing Icon]]'
result = 'Icon does not exist[[Category:Missing Icon]]'

Navigation menu