Zelda Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!

Come join the Zelda Wiki community Discord server!

READ MORE

Zelda Wiki
Advertisement
This is the main module for the following templates:
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)
	local categories = utilsTable.map(games or {}, 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 [[Guidelines:Terminology|term]] references.",
		format = "inline",
		params = {
			[1] = {
				name = "games",
				placeholder = "game1, game2, ..., gameN",
				type = "string",
				enum = Franchise.enum(),
				desc = "A comma-separated list of [[Data:Franchise|game codes]] indicating specific games lacking references for a given term.",
				split = true,
				sortAndRemoveDuplicates = true,
			}
		},
		examples = {
			{},
			{"OoT"},
			{"OoT, BotW"},
			{"fakeGame"},
			{"BotW, BotW, OoT, fakeGame"},
		}
	}
}

return p
Advertisement