Module:TagList

From Eco - English Wiki
Revision as of 02:43, 18 July 2025 by StalEF (talk | contribs)

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:


local p = {}

local Utils = require('Module:Utils')
local IconUtils = require('Module:IconUtils')
local L = require('Module:Localization')
local Lang = Utils.getLanguageName()

-- Main entry point for the Module
function p.main()
  
  -- 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
            
            if v.IsVisibleInTooltip == 'True' then
            	local TagName = v.Name[Lang]
          	   	local tagLink = L.t('%s Tag'):format(TagName)
            	local tagID = v.ID
            	
            	text = text .. '<div class="col-lg-3">\n'
            	text = text .. IconUtils.main{ name = TagName, id = tagID, size = 32, style = 2, link = tagLink }
            	text = text .. '</div>\n'
			end
      end

    text = text .. '</div>'

  return text
end

return p