Module:Link: Difference between revisions
MusikAnimal (talk | contribs) No edit summary |
MusikAnimal (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
local function link( content, title, linkType, linkSubtype ) | 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' }) do | 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' }) do | ||
local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|' | local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|' | ||
content = mw.ustring.gsub( content, subject, '[[:' .. cat_str .. subject .. ']][[' .. cat_str .. title .. ']]' ) | content = mw.ustring.gsub( content, subject, '[[:' .. cat_str .. subject .. ']][[' .. cat_str .. title .. ']]' ) |
Revision as of 20:12, 18 April 2020
Documentation for this module may be created at Module:Link/doc
local str = {}
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' }) 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
-- local function linkAlbum( content, title, albumType )
-- for _i, subject in ipairs({ 'Gish', 'Siamese Dream', 'Mellon Collie and the Infinite Sadness' }) 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 str.album( frame )
local content = frame.args[1]
local title = frame.args[2]
local albumType = frame.args[3]
if content == '' then
return content
end
end
function str.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 str.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 str