Module:TagList
From Eco - English Wiki
This module provides the back end functionality of the Template:TagsList.
If the template is passed, this module creates a list using details from the following Modules:
Credit[edit source]
Original SkillList was created by Fyre (FishAus) then edited by Scotty (ZeelNightwolf) and used as a base for TagsList.
local p = {}
local Utils = require('Module:Utils')
local IconUtils = require('Module:IconUtils')
local L = require('Module:Localization')
-- Main entry point for the Module
function p.main(frame)
-- get args from the Template
local args = Utils.normaliseArgs(frame)
if args.list == nil or args.list == '' then return '\'list\' must be specified.' end
-- assign variables for list
local list = args.list
-- load lists
local TagData = mw.loadData("Module:TagData")
local tagList = TagData.tags
local text = ''
--Check Passes
if list ~= 'tags' then return ' Incorrect use of pass. ' end
text = '<div class="row">\n'
for k,v in pairs(tagList) do
local tagLink = L.t('%s Tag'):format(k)
local tagID = v.ID
if v.IsVisibleInTooltip == 'False' then tagID = 'Tags' end
text = text .. '<div class="col-lg-3">\n'
text = text .. IconUtils.main{ name = k, id = tagID, size = 32, style = 2, link = tagLink }
text = text .. '</div>\n'
end
text = text .. '</div>'
return text
end
return p