Difference between revisions of "Module:Icon"

Jump to navigation Jump to search
no edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 5: Line 5:


local function _requirements(resource, value, link, text, lang)
local function _requirements(resource, value, link, text, lang)
--[[ Language switch isn't acctually needed, but stems from early design when
--[[ Language switch isn't actually needed, but stems from early design when
all languages would have a single wiki, leaving in as this may change in the
all languages would have a single wiki, leaving in as this may change in the
future ]]
future ]]
Line 17: Line 17:
if resource ~= nil then
if resource ~= nil then
-- Init link here, will be nil if resource is nil
-- Init link here, will be nil if resource is nil
if not com.exists(link) then
if not com.exists(link) then
Line 26: Line 27:
--Check after trim as may be whitespace only
--Check after trim as may be whitespace only
if com.exists(value) then
if com.exists(value) then
value = ' (' .. value .. ')'
value = '' .. value .. ' '
else
else
value = ''
value = ''
Line 33: Line 34:
result = '[[file:'  
result = '[[file:'  
.. resource['file']  
.. resource['file']  
.. '|16px|link='
.. '|20px|link='
.. link
.. link
.. ']]'
.. ']]'
Line 39: Line 40:
if com.exists(text) then
if com.exists(text) then
if string.lower(text) ~= 'no' then
if string.lower(text) ~= 'no' then
result = result .. '[['
result = result .. ' [['
.. link
.. link
.. ']]'
.. ']]'
end
end
end
end
result = result .. value
result = value .. result
else
else
result = 'Icon does not exist[[Category:Missing Icon]]'
result = 'Icon does not exist[[Category:Missing Icon]]'
455

edits

Navigation menu