Module:Link: Difference between revisions
MusikAnimal (talk | contribs) No edit summary |
MusikAnimal (talk | contribs) No edit summary |
||
Line 17: | Line 17: | ||
end | end | ||
return | return link(content, linkType, 'produced') | ||
end | end | ||
Line 27: | Line 27: | ||
end | end | ||
return | return link(content, linkType, 'written') | ||
end | end | ||
return str | return str |
Revision as of 22:09, 17 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', '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