FANDOM


-- <pre>
-- This will likely be expanded when other infoboxes are converted to Lua
-- For now, it will just be a categories handler
 
local p = {}
 
local onmain = require('Module:Mainonly').on_main
local yesno = require('Module:Yesno')
local empty = require('Module:Paramtest').is_empty
 
local composers = {
	['ian t'] = '[[Category:Music composed by Ian Taylor]]',
	['grace d'] = '[[Category:Music composed by Grace Docksey]]',
	['adam b'] = '[[Category:Music composed by Adam Bond]]',
	['stephen l'] = '[[Category:Music composed by Stephen Lord]]',
	['adam r'] = '[[Category:Music composed by Adam Ritchie]]',
	['michael m'] = '[[Category:Music composed by Michael Manning]]',
	['ian h'] = '[[Category:Music composed by Iain Hetherington]]',
	['iain h'] = '[[Category:Music composed by Iain Hetherington]]',
	['chris j'] = '[[Category:Music composed by Chris Jolley]]',
	['dan a'] = '[[Category:Music composed by Dan Atkinson]]',
	['james h'] = '[[Category:Music composed by James Hannigan]]',
	['sam j'] = '[[Category:Music composed by Sam Jones]]',
	['ashleigh b'] = '[[Category:Music composed by Ashleigh Bridges]]',
	['abbie d'] = '[[Category:Music composed by Abbie Day]]'
}
 
function p.cats(frame)
	if not onmain() then
		return ''
	end
	local args = frame:getParent().args
	return p.categories {
			number = args.number,
			file = args.file,
			release = args.release,
			update = args.update,
			members = args.members,
			location = args.location,
			hint = args.hint,
			vocals = args.vocals,
			instruments = args.instruments,
			duration = args.duration,
			composer = args.composer,
			map = args.map
	}
end
 
function p.categories(...)
	local args = ...
	local ctgy = '[[Category:Music tracks]]'
	if yesno(args.vocals) then
		ctgy = ctgy..'[[Category:Music tracks with vocals]]'
	end
	if empty(args.number) then
		ctgy = ctgy..'[[Category:Missing track number]]'
	end
	if empty(args.file) then
		ctgy = ctgy..'[[Category:Needs audio added]]'
	end
	if empty(args.release) then
		ctgy = ctgy..'[[Category:Needs release date]]'
	end
	if empty(args.update) then
		ctgy = ctgy..'[[Category:Needs update added]]'
	end
	if empty(args.members) then
		ctgy = ctgy..'[[Category:Needs members status]]'
	end
	if empty(args.location) then
	    ctgy = ctgy..'[[Category:Missing track location]]'
	end
	if empty(args.hint) then
		ctgy = ctgy..'[[Category:Missing unlock hint]]'
	end
	if empty(args.instruments) then
		ctgy = ctgy..'[[Category:Needs instruments]]'
	end
	if empty(args.duration) then
		ctgy = ctgy..'[[Category:Needs track duration added]]'
	end
	if empty(args.composer) then
		ctgy = ctgy..'[[Category:Needs composer added]]'
	else
		local complist = string.lower(args.composer)
		local compcount = 0
		for name, cat in pairs(composers) do
			if complist:find(name) then
				ctgy = ctgy..cat
				compcount = compcount + 1
			end
		end
		if compcount > 1 then
			ctgy = ctgy..'[[Category:Tracks with multiple composers]]'
		end
	end
	return ctgy
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.