Editing Module:TagsList

From Eco - English Wiki

Your changes will be displayed to readers once an authorized user accepts them. (help)

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 3: Line 3:
local p = {}
local p = {}


local Utils = require('Module:Utils')
-- Grabs args from the parent frame
local L = require('Module:Localization')
-- Trims and parses the args into a table, then returns the table
function norm()
    local origArgs = mw.getCurrentFrame():getParent().args
    local args = {}
   
    for k, v in pairs( origArgs ) do
        v = mw.text.trim( tostring( v ) )
        if v ~= '' then
            args[k] = v
        end
    end
   
    return args
end


-- Main entry point for the Module
-- Main entry point for the Module
function p.main(frame)
function p.main()
  -- get args from the Template
    -- get args from the Template
  local args = Utils.normaliseArgs(frame)
     local args = norm()
 
  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 itemData = mw.loadData("Module:ItemData")
  local tagsList = ''
 
  --Check Passes
  if list ~= 'tags' then
    return tagsList .. ' Incorrect use of pass. '
  end
 
  local a = {}
  --Tags List
  if list == 'tags' then
    tagsList = tagsList .. '=== Tags List ===\n'
    tagsList = tagsList .. '<div style=\"column-count:3;-moz-column-count:3;-webkit-column-count:3\">\n'
      
      
    for k, v in pairs(itemData.tags) do
if args.list == nil or args.list == '' then
      if itemData.tags[k] ~= nil then
        return '\'list\' must be specified.'
        table.insert(a, k)
      end
    end
    table.sort(a)
    for i, n in ipairs(a) do
      local link = L.t('%s Tag'):format(n)
      tagsList = tagsList .. '* [[' .. link .. '|' .. n .. ']]\n'
     end
     end
     tagsList = tagsList .. '[[Category:Tags]]</div>'
  end
    -- assign variables for list
    local list = args.list
    -- load lists
     local itemData = require( "Module:ItemData" )
local tagsList = ''


  return tagsList
--Check Passes
if list ~= 'tags' then
        return tagsList .. ' Incorrect use of pass. '
    end
local a = {}
--Tags List
if list == 'tags' then
tagsList = tagsList .. '=== Tags List ===\n'
tagsList = tagsList .. '<div style=\"column-count:2;-moz-column-count:2;-webkit-column-count:2\">\n'
for k,v in pairs(itemData.tags) do       
            if itemData.tags[k] ~= nil then
              table.insert(a,k)
            end
        end
        table.sort(a)
        for i,n in ipairs(a) do
            tagsList = tagsList .. '* [[' .. n .. 'Tag|' .. n .. ']]\n'   
        end
tagsList = tagsList .. '</div>'
end
return tagsList
end
end


return p
return p
Please note that all contributions to Eco - English Wiki are considered to be released under the CC BY-NC-SA 4.0 (see Eco:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)

Template used on this page: