Module:Infobox Music

-- -- 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 = { ['mod ian'] = '', ['mod grace'] = '', ['mod bond'] = '', ['mod lord'] = '', ['andrew l'] = '', ['mod adam r'] = '', ['michael m'] = '', ['iain h'] = '', ['chris j'] = '', ['mod dan a'] = '', ['james h'] = '', ['sam j'] = '', ['mod ash'] = '', ['abbie d'] = '', ['mod slippers'] = '', ['helen r'] = '', ['linda h'] = '', ['mod surma'] = '' }

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 = '' if yesno(args.vocals) then ctgy = ctgy..'' end if empty(args.number) then ctgy = ctgy..'' end if empty(args.file) then ctgy = ctgy..'' end if empty(args.release) then ctgy = ctgy..'' end if empty(args.update) then ctgy = ctgy..'' end if empty(args.members) then ctgy = ctgy..'' end if string.lower(args.members) == 'yes' then ctgy = ctgy..'' end if string.lower(args.members) == 'no' then ctgy = ctgy..'' end if empty(args.location) then ctgy = ctgy..'' end if empty(args.hint) then ctgy = ctgy..'' end if empty(args.instruments) then ctgy = ctgy..'' end if empty(args.duration) then ctgy = ctgy..'' end if empty(args.composer) then ctgy = ctgy..'' 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..'' end end return ctgy end

return p