Module:Genre

local utils = require('Module:Utils')

local categorize = utils.categorize('Catalog', 'Community')

local p = {}

local genres = {'Building', 'Horror', 'Town and city', 'Military', 'Comedy', 'Fighting', 'Medieval', 'Adventure', 'Sci-fi', 'FPS', 'Naval', 'RPG', 'Sports', 'Western'}

function p._format_genre(args) local genre = args.genre == 'Town and City' and "Town and city" or args.genre if genre == 'All' then return " All" elseif genres[genre] then return " " .. genre .. categorize(genre .. " " .. args["category suffix"]) else return error("Invalid genre") end end

p.format_genre = utils.make_wrapper_function(p._format_genre)

function p._enumerate_genres(args) local output = "" for genre in args.genres:gmatch('[^/,]+') do output = output .. "* " .. p._format_genre {genre = genre} end end

p.enumerate_genres = utils.make_wrapper_function(p._enumerate_genres)

return p