Module:Link: Difference between revisions

From SPCodex, The Smashing Pumpkins wiki
No edit summary
(+)
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
local str = {}
local str = {}
local function link( 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
local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|' .. subject
content = mw.ustring.gsub( content, subject, '[[:' .. cat_str .. ']][[' .. cat_str .. ']]' )
end
return content
end


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


-- for _i, subject in ipairs({ 'Butch Vig', 'Billy Corgan' }) do
return link(content, linkType, 'produced')
-- mw.ustring.gsub( content, subject, '[[:Category:Songs produced by ' .. subject .. '|' .. subject .. ']]' )
end
-- end
 
function str.writer( frame )
local content = frame.args[1]
local linkType = frame.args[2]
if content == '' then
return content
end


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


return str
return str

Revision as of 01:57, 18 April 2020

Documentation for this module may be created at Module:Link/doc

local str = {}

local function link( 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
		local cat_str = 'Category:' .. linkType .. 's ' .. linkSubtype .. ' by ' .. subject .. '|' .. subject
		content = mw.ustring.gsub( content, subject, '[[:' .. cat_str .. ']][[' .. cat_str .. ']]' )
	end
	
	return content
end

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

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

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

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

return str