Module:FrontpageItemList

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil')

local h = {}

local p = {} function p.main(frame) local args = util_args.merge(true) return h.makeOutput(util_cargo.getOrderedList(h.getQuery(args), 'Name'), args) end

function h.getQuery(args) local ret = { tables = 'Items', where = ('Tier="%s"'):format(args.tier), fields = 'Name', limit = 9999, orderBy = 'Name', }	return ret end

function h.makeOutput(list, args) local output = mw.html.create('div') :addClass('frontpage-item-outer') :addClass(('frontpage-item-outer-%s'):format(args.tier:lower)) :wikitext(mw.getCurrentFrame:expandTemplate{			title='FP heading',			args = { args.tier, type = 'subheading' }		}) local inner = output:tag('div') :addClass('frontpage-item-inner') for _, item in ipairs(list) do		h.printitem(inner, item) end return output end

function h.printitem(output, item) local div = output:tag('div') :addClass('frontpage-item-item') :attr('data-display', item) :wikitext((''):format(item, item)) h.printitemName(div, item) end

function h.printitemName(div, item) div:tag('div') :addClass('frontpage-caption') :wikitext(('%s'):format(item, item)) end

return p