Difference between revisions of "Module:Icon"

Jump to navigation Jump to search
no edit summary
 
(8 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)
if string.lower(lang) == 'en' then
--[[ Language switch isn't acctually needed, but stems from early design when
all languages would have a single wiki, leaving in as this may change in the
future ]]
if lang and string.lower(lang) == 'en' then
require('Module:Icon/en')
require('Module:Icon/en')
else
else
require('Module:Icon/en') -- if no language is supplied opr code is invalid, fallback to english
require('Module:Icon/en') -- if no language is supplied or code is invalid, fallback to english
end
end
resource = string.lower(com.trim(resource))
resource = string.lower(com.trim(resource))
Line 15: Line 18:
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 com.exists(link) == false then
if not com.exists(link) then
link = resource['link']
link = resource['link']
end
end
Line 27: Line 30:
value = ''
value = ''
end
end
 
result = '[[file:'  
result = '[[file:'  
.. resource['file']  
.. resource['file']  
.. '|16px|link='
.. '|20px|link='
.. link
.. link
.. ']]'
.. ']]'
Line 37: Line 39:
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
.. ']]'
.. ']]'
106

edits

Navigation menu