Module:Catalog history

local casefold = require("Module:Casefold") local categorization = require("Module:Categorization") local table_builder = require("Dev:Tablebuilder") local utils = require("Module:Utils")

local categorize = categorization.categorize_in_namespaces(0, "Catalog")

local function format_location(location, past_tense) local verb = past_tense and "was" or "is" local category, text, tooltip if casefold.matches_in(   location, {"ingame", "in-game", "in game", "game", "event"}  ) then category = "Items obtained in a game" text = "In-game" tooltip = "This item " .. verb .. " received in a Roblox game." elseif casefold.matches_in(location, {"catalog", "avatar shop"}) then category = "Items obtained in the avatar shop" text = "Avatar Shop" tooltip = "This item " .. verb .. " purchasable in the avatar shop." elseif casefold.matches_in(   location, {"limited", "limitedu", "limited item"}  ) then category = "Items obtained in the avatar shop" text = "Avatar Shop (limited)" tooltip = (     "This item "      .. verb      .. " purchasable in the avatar shop and can be resold by owners."    ) elseif casefold.matches_in(   location,    {"promotional code", "promotional-code", "promotional", "promotionalcode"}  ) then category = "Items obtained with a promotional code" text = "Promotional code" tooltip = "This item " .. verb .. " received through a promotional code." elseif casefold.matches_in(location, {"ad", "advertisement", "advert"}) then category = "Items obtained from a Roblox advertisement" text = "Advertisement" tooltip = (     "This item "      .. verb      .. " received through an online advertisement."    ) elseif casefold.matches_in(location, {"opened", "gift", "gifted"}) then category = "Items that came out of gifts" text = "Opened" tooltip = "This item " .. verb .. " received through a Roblox gift." elseif casefold.matches_in(   location,    {"gamecard", "game card", "game-card", "roblox card", "gift card"}  ) then category = "Gift card items" text = "Gift card" tooltip = "This item " .. verb .. " received through a Roblox gift card." elseif casefold.matches_in(   location, {"select", "select user", "select users"}  ) then category = "Items awarded to specific users" text = "Select users" tooltip = "This item " .. verb .. " awarded to specific users." elseif casefold.matches_in(location, {"toy", "roblox toy", "toy code"}) then category = "Toy items" text = "Toy code" tooltip = "This item " .. verb .. " received through a Roblox toy code." elseif casefold.matches_in(location, {"bundle item", "bundle"}) then category = "Bundle items" text = "Bundle item" tooltip = "This item is part of a bundle." else return location end return tostring(   mw.html.create("span")      :addClass("explain")      :attr("title", tooltip)      :wikitext(text)  ) .. categorize(category) end

local p = {}

function p._generate_table(args) local entries = while true do   local suffix = tostring(#entries) local location = args["location" .. suffix] local available_from = args["from" .. suffix] local available_until = args["until" .. suffix] if #entries == 1 then location = location or args.location available_from = available_from or args.from available_until = available_until or args["until"] end if not location and not available_from and not available_until then break end location = location or "Avatar Shop" available_from = available_from or "Unknown" available_until = available_until or "Unknown" local still_available = casefold.matches_in(     available_until, {"available", "still available"}    ) table.insert(entries, {     format_location(location, not still_available),      available_from,      available_until    }) end return table_builder.new(entries, nil, nil, {"article-table"}):getTable end

p.generate_table = utils.make_wrapper_function(p._generate_table)

return p