Module:Infobox album: Difference between revisions
MusikAnimal (talk | contribs) No edit summary |
MusikAnimal (talk | contribs) No edit summary |
||
Line 73: | Line 73: | ||
category = 'Bootleg albums' | category = 'Bootleg albums' | ||
} | } | ||
} | |||
local artist = { | |||
'The Smashing Pumpkins', | |||
'Billy Corgan', | |||
'Zwan', | |||
'James Iha', | |||
'Jimmy Chamberlin Complex', | |||
'Various artists' | |||
} | } | ||
Line 88: | Line 97: | ||
local given = mw.text.split(frame.args[1], "%s*,%s*") | local given = mw.text.split(frame.args[1], "%s*,%s*") | ||
local artist = frame.args[2] | local artist = frame.args[2] | ||
if artists[artist] == nil then | |||
return | |||
end | |||
local cats = '[[Category:Albums]][[Category:' .. artist .. ' albums]]' | local cats = '[[Category:Albums]][[Category:' .. artist .. ' albums]]' |
Revision as of 20:38, 10 June 2020
Documentation for this module may be created at Module:Infobox album/doc
local p = {}
local types = {
['ep'] = {
color = 'lightsalmon',
link = '[[:Category:EPs|EP]]',
category = 'EPs',
respect_casing = true
},
['studio'] = {
color = 'lightsteelblue',
link = '[[:Category:Studio albums|Studio album]]',
category = 'Studio albums'
},
['demo'] = {
color = 'khaki',
link = '[[:Category:Demo albums|Demo album]]',
category = 'Demo albums'
},
['live'] = {
color = 'burlywood',
link = '[[:Category:Live albums|Live album]]',
category = 'Live albums'
},
['greatest hits'] = {
color = 'darkseagreen',
link = '[[:Category:Compilation albums|Compilation album]]',
category = 'Compilation albums'
},
['box set'] = {
color = 'darkseagreen',
link = '[[:Category:Box sets|Box set]]',
category = 'Box sets'
},
['compilation'] = {
color = 'darkseagreen',
link = '[[:Category:Compilation albums|Compilation album]]',
category = 'Compilation albums'
},
['remix'] = {
color = 'peachpuff',
link = '[[:Category:Remix album|Remix album]]',
category = 'Category:Remix albums'
},
['soundtrack'] = {
color = 'gainsboro',
link = '[[:Category:Soundtrack albums|Soundtrack]]',
category = 'Soundtrack albums'
},
['film score'] = {
color = 'gainsboro',
link = '[[:Category:Soundtrack albums|Soundtrack album]]',
category = 'Soundtrack albums'
},
['video'] = {
color = ' #99CCFF',
link = '[[:Category:Video releases|Video release]]',
category = 'Video releases'
},
['promotional'] = {
color = 'peachpuff',
link = '[[:Category:Promotional releases|Promotional release]]',
category = 'Promotional releases'
},
['tribute'] = {
color = 'peachpuff',
link = '[[:Category:Tribute albums|Tribute album]]',
category = 'Tribute albums'
},
['bootleg'] = {
color = ' #E6E8FA',
link = '[[:Category:Bootleg albums|Bootleg]]',
category = 'Bootleg albums'
}
}
local artist = {
'The Smashing Pumpkins',
'Billy Corgan',
'Zwan',
'James Iha',
'Jimmy Chamberlin Complex',
'Various artists'
}
function p.link( frame )
local given = mw.text.split(frame.args[1], "%s*,%s*")
return types[given[1]].link
end
function p.color( frame )
local given = mw.text.split(frame.args[1], "%s*,%s*")
return types[given[1]].color
end
function p.categories( frame )
local given = mw.text.split(frame.args[1], "%s*,%s*")
local artist = frame.args[2]
if artists[artist] == nil then
return
end
local cats = '[[Category:Albums]][[Category:' .. artist .. ' albums]]'
for _, v in ipairs(given) do
local data = types[v]
cats = cats .. '[[Category:' .. data.category .. ']]'
if artist ~= 'Various artists' then
if data.respect_casing then
cats = cats .. '[[Category:' .. artist .. ' ' .. data.category .. ']]'
else
cats = cats .. '[[Category:' .. artist .. ' ' .. data.category:lower() .. ']]'
end
end
end
return cats
end
return p