Module:Link: Difference between revisions

23 bytes added ,  18 April 2020
no edit summary
(+)
No edit summary
Line 1: Line 1:
local str = {}
local str = {}


local function link( content, linkType, linkSubtype )
local function link( title, content, linkType, linkSubtype )
for _i, subject in ipairs({ 'Billy Corgan', 'James Iha', "D'arcy Wretzky", 'Jimmy Chamberlin', 'Butch Vig', 'Flood', 'Alan Moulder', 'Kerry Brown' }) do
for _i, subject in ipairs({ 'Billy Corgan', 'James Iha', "D'arcy Wretzky", 'Jimmy Chamberlin', 'Butch Vig', 'Flood', 'Alan Moulder', 'Kerry Brown' }) do
local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|' .. subject
local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|'
content = mw.ustring.gsub( content, subject, '[[:' .. cat_str .. ']][[' .. cat_str .. ']]' )
content = mw.ustring.gsub( content, subject, '[[:' .. cat_str .. subject .. ']][[' .. cat_str .. '|' .. title .. ']]' )
end
end