Difference between revisions of "Module:Icon"

Jump to navigation Jump to search
32 bytes added ,  20:03, 23 October 2021
no edit summary
Line 1: Line 1:
--<nowiki>
--<nowiki>
local p = {}
local p = {}
require('Module:Common')
local com = require('Module:Common')
require('Module:Icon/data')
require('Module:Icon/data')


local function _requirements(resource, value, link, text)
local function _requirements(resource, value, link, text)
resource = string.lower(trim(resource))
resource = string.lower(com.trim(resource))
resource = iconList[resource]
resource = iconList[resource]
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 exists(link) == false then
if com.exists(link) == false then
link = resource['link']
link = resource['link']
end
end
--No point trimming the value if it won't be used
--No point trimming the value if it won't be used
value = trim(value)
value = com.trim(value)
--Check after trim as may be whitespace only
--Check after trim as may be whitespace only
if exists(value) == true then
if com.exists(value) == true then
value = ' (' .. value .. ')'
value = ' (' .. value .. ')'
end
end
Line 28: Line 28:
.. ']]'
.. ']]'
if exists(text) == true then
if com.exists(text) == true then
if string.lower(text) ~= 'no' then
if string.lower(text) ~= 'no' then
result = result .. '[['
result = result .. '[['

Navigation menu