Editing Module:TagDetails

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 1: Line 1:
-- Credit: User:Avaren
-- Credit: User:Avaren
local Utils = require('Module:Utils')
local L = require('Module:Localization')


local p = {}
local p = {}


local function icon_frame(name, link, bg, text, expensive)
-- Grabs args from the parent frame
     local icon = Utils.build_icon(name, link, nil, bg, nil, expensive)
-- Trims and parses the args into a table, then returns the table
    return '<div style="border: 5px outset #A9A9A9; background: #DCDCDC; display:inline-block; width: auto; padding: 10px; margin: 10px; text-align: center; vertical-align: middle;">' .. icon .. text ..'</div>'
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
end


-- build tag list
-- build tag list
function p.tagList(frame)
function p.tagList( args )
    local args = Utils.normaliseArgs(frame)
local args = norm()
 
    -- check that all necessary arguments are passed correctly
-- check that all necessary arguments are passed correctly
    if args.name == nil or args.name == '' then
if args.name == nil or args.name == '' then
        return '\'name\' must be specified.'
    return '\'name\' must be specified.'
    end
end
 
    local tagName = args.name
 
    local itemData = mw.loadData("Module:ItemData")
 
    local tagList = itemData.tags
 
    local itemList = tagList[tagName]
 
    if (itemList == nil) then
        return tagName .. " could not be found in Module:ItemData"
    end


    local text = ""
local tagName = args.name
local itemData = require( "Module:ItemData" )
local tagList = itemData.tags
local itemList = tagList[tagName]
if (itemList == nil) then
return tagName .. " could not be found in the Module:ItemData"
end


    local tagLink = L.t('%s Tag'):format(tagName)
local text = ""


    text = text .. icon_frame(L.tag(tagName) .. 'Tag', tagLink, 'iconWhite', '<h3>[[' .. tagLink .. ']]</h3>', false)
text = text .. '<div style="border: 5px outset #A9A9A9; background: #DCDCDC; display:inline-block; width: auto; padding: 10px; margin: 10px; text-align: center; vertical-align: middle;">'
text = text .. '<div class="iconContainer">'
text = text .. '<div class="iconStack">[[File:'..string.gsub(tagName, ' ', '')..'_Icon.png|class=iconWhite|link='..tagName..'Tag]]</div>'
text = text .. '<div class="iconBorder"></div></div>'
text = text .. '<h3>[['..tagName..'Tag]]</h3></div>'


    local tagCount = Utils.tableLen(itemList)
text = text .. '\n\n\nItems with the '..tagName..' Tag:\n'
    if tagCount > 98 then
        expensive = true
    else
        expensive = false
    end


    text = text .. '\n\n\n' .. string.format(L.t('Item with the %s Tag:', tagCount), tagName) .. '\n'
for k, item in pairs(itemList) do


    for _, item in pairs(itemList) do
text = text .. '<div style="border: 5px outset #A9A9A9; background: #DCDCDC; display:inline-block; width: auto; padding: 10px; margin: 10px; text-align: center; vertical-align: middle;">'
        text = text .. icon_frame(item, item, nil, '<h3>[[' .. item .. ']]</h3>', expensive)
text = text .. '<div class="iconContainer">'
    end
text = text .. '<div class="iconStack">[[File:'..string.gsub(item, ' ', '')..'_Icon.png|class=iconBlue|link='..item..']]</div>'
 
text = text .. '<div class="iconBorder"></div></div>'
    return text
text = text .. '<h3>[['..item..']]</h3></div>'
end


-- text = text .. '{{IconFrame|file='..item..'_Icon.png|link = '..item..'|text = <h3>[['..item..']]</h3>}}'
end
return text
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: