Module:Infobox album: Difference between revisions
MusikAnimal (talk | contribs) (Created page with "local p = {} local types = { ['ep'] = { color = 'lightsalmon', link = 'EP', category = 'EPs', respect_casing = true }, ['studio'] = { color = '...") |
MusikAnimal (talk | contribs) No edit summary |
||
Line 72: | Line 72: | ||
function p.link( frame ) | function p.link( frame ) | ||
local given = mw.text.split(frame.args[1], "%s*,%s*") | local given = mw.text.split(frame.args[1], "%s*,%s*") | ||
print(given) | |||
print(given[1]) | |||
return types[given[1]].link | return types[given[1]].link | ||
end | end |
Revision as of 05:28, 20 May 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 album'
},
['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 album]]',
category = 'Soundtrack albums'
},
['film score'] = {
color = 'gainsboro',
link = '[[:Category:Soundtrack albums|Soundtrack album]]',
category = 'Soundtrack albums'
},
['video'] = {
color = ' #99CCFF',
link = '[[:Category:Music videos|Video]]',
category = 'Music videos'
},
['tribute'] = {
color = 'peachpuff',
link = '[[:Category:Tribute albums|Tribute album]]',
category = 'Tribute albums'
},
['bootleg'] = {
color = ' #E6E8FA',
link = '[[:Category:Bootleg albums|Bootleg]]',
category = 'Bootleg albums'
}
}
function p.link( frame )
local given = mw.text.split(frame.args[1], "%s*,%s*")
print(given)
print(given[1])
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]
local cats = ''
for _, v in ipairs(types) do
local data = types[v]
cats = cats .. '[[Category:' .. data.category .. ']]'
if data.respect_casing then
cats = cats .. '[[Category:' .. artist .. ' ' .. data.category .. ']]'
else
cats = cats .. '[[Category:' .. artist .. ' ' .. data.category:lower() .. ']]'
end
end
end
return p