Module:Link

local p = {}

local function link( content, title, linkType, linkSubtype ) for _i, subject in ipairs({ 'Billy Corgan', 'James Iha', "D'arcy Wretzky", 'Jimmy Chamberlin', 'Butch Vig', 'Flood', 'Alan Moulder', 'Kerry Brown', 'Bjorn Thorsrud', 'Nellee Hooper', 'Terry Date', 'Jeff Schroeder', 'Howard Willing', 'Rick Rubin', 'Roy Thomas Baker', 'Brad Wood', 'Dale Griffin', 'Ted de Bono' }) do local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|'		content = mw.ustring.gsub( content, subject,  .. cat_str .. subject ..  .. cat_str .. title .. '' ) end return content end

function p._link(content, kind) local t = {} for s in string.gmatch(content, "([^,]+)") do		s = mw.text.trim(s) if kind == 'album' then s = "" .. s .. "" elseif kind == 'song' then s = '"' .. s .. '"' end table.insert(t, s)	end

local ret = '' for _i, s in pairs(t) do ret = ret .. ', ' .. s	end return mw.text.trim(ret, ', ') end

function p.album( frame ) local content = frame.args[1] if content == '' then return content end return p._album(content, album) end

function p.producer( frame ) local content = frame.args[1] local title = frame.args[2] local linkType = frame.args[3] if content == '' then return content end

return link(content, title, linkType, 'produced') end

function p.writer( frame ) local content = frame.args[1] local title = frame.args[2] local linkType = frame.args[3] if content == '' then return content end

return link(content, title, linkType, 'written') end

return p