Module:Name Ref

local Franchise = require("Module:Franchise") local utilsArg = require("Module:UtilsArg") local utilsMarkup = require("Module:UtilsMarkup") local utilsTable = require("Module:UtilsTable")

local p = {}

function p.GamesToCategories(frame) local args, err = utilsArg.parse(frame:getParent.args, p.Templates["Name Ref"]) local categories = p.gamesToCategories(args.games) if err then categories = utilsTable.concat(categories, err.categories) end return utilsMarkup.categories(categories) end

function p.gamesToCategories(games) games = games or {} -- this effectively sorts the game array and removes non-valid games games = utilsTable.intersection(Franchise.enum, games) local categories = utilsTable.map(games, p.gameToCategory) table.insert(categories, 1, "Pages Lacking Name References") return categories end

function p.gameToCategory(game) return Franchise.shortName(game) .. " Pages Lacking Name References" end

p.Templates = { ["Name Ref"] = { purpose = "Use this template as a placeholder for missing term references.", format = "inline", params = { [1] = {				name = "games", placeholder = "game1, game2, ..., gameN", type = "string", enum = Franchise.enum, desc = "A comma-separated list of game codes indicating specific games lacking references for a given term.", split = true, }		},		examples = { {},			{"OoT"}, {"OoT, BotW"}, {"fakeGame"}, {"BotW, OoT, fakeGame"}, }	} }

return p