Module:Cite certification/handlers/sandbox
Appearance
| This is the module sandbox page for Module:Cite certification/handlers. |
local yesno = require('Module:Yesno')
local function notblank(v) return (v or '') ~= '' end
local function isblank(v) return (v or '') == '' end
return {
argentina = function(args)
if isblank(args.artist) and isblank(args.title) then
return 'AT LEAST ONE OF artist OR title MUST BE PROVIDED FOR ARGENTINIAN CERTIFICATION.'
end
return {
titleRegion = 'Argentinian',
publisher = '[[Argentine Chamber of Phonograms and Videograms Producers]]'
}
end,
australia = function (args)
local source = mw.ustring.lower(args.source or '')
local typ = mw.ustring.lower(args.type or '')
local certyear = tonumber(args.certyear)
if source == 'book' then
if isblank(args.id) then
return 'THE FIELD id (page) MUST BE PROVIDED FOR AUSTRALIA CERTIFICATION FROM book.'
end
return {
title = "Australia's Music Charts 1988–2010",
first = 'Gavin',
last = 'Ryan',
publisher = 'Moonlight Publishing',
location = 'Mt Martha, Victoria, Australia',
year = '2011',
edition = 'PDF',
page = args.id,
ref = args.ref
}
elseif source == 'yearchart' then
if not certyear then
return 'NO certyear WAS PROVIDED FOR AUSTRALIAN CERTIFICATION.'
elseif certyear < 1988 then
return 'certyear FOR AUSTRALIAN CERTIFICATION FROM YEAR CHARTS MUST BE 1988 OR LATER'
end
local media = ({
album = 'Album',
single = 'Single',
video = 'Music DVD',
})[typ]
if not media then
return 'type FOR AUSTRALIAN CERTIFICATION MUST BE "album", "single", OR "video".'
end
local count = 50
if certyear > 1997 and (typ == 'album' or typ == 'single') then
count = 100
end
return {
title = 'ARIA Top ' .. count .. ' ' .. media .. 's for ' .. certyear,
publisher = '[[Australian Recording Industry Association]]',
note = certyear == 1992 and 'Set year to 1992.' or nil,
}
end
if notblank(args.id) then
return {
title = 'ARIA Top ' ..
(yesno(args.domestic) and '20 Australian' or '50') .. ' ' ..
(mw.ustring.lower(args.type or '') == 'single' and 'Singles' or 'Albums') ..
' for week of {{date|' .. args.id .. '}}',
publisher = '[[Australian Recording Industry Association]]',
date = mw.getContentLanguage():formatDate("j F Y", args.id),
}
end
if not certyear then
return 'NO certyear OR id WAS PROVIDED FOR AUSTRALIAN CERTIFICATION.'
elseif certyear < 1990 then
return 'certyear FOR AUSTRALIAN CERTIFICATION FOR ALBUMS/SINGLES MUST BE 1990 OR LATER.'
end
local media = ({
album = 'Albums',
single = 'Singles',
video = 'DVDs',
})[typ]
if not media then
return 'type FOR AUSTRALIAN CERTIFICATION MUST BE "album", "single", OR "video".'
end
return {
title = 'ARIA Charts – Accreditations – ' .. certyear .. ' ' .. media,
publisher = '[[Australian Recording Industry Association]]',
}
end,
austria = function() return {
titleRegion = 'Austrian',
publisher='[[International Federation of the Phonographic Industry|IFPI]] Austria',
language='German'
} end,
belgium = function(args)
if isblank(args.certyear) then
return 'NO certyear WAS PROVIDED FOR BELGIAN CERTIFICATION.'
end
return {
title = 'Ultratop − Goud en Platina – ' ..
(notblank(args.type) and (args.type .. 's ') or '') ..
args.certyear,
publisher = '[[Ultratop]]. Hung Medien',
archive = true,
}
end,
brazil = function(args)
if isblank (args.artist) then
return 'NO artist WAS PROVIDED FOR BRAZILIAN CERTIFICATION.'
end
return {
titleRegion = 'Brazilian',
publisher = '[[Pro-Música Brasil]]',
language = 'Portuguese',
}
end,
canada = function() return {
titleRegion = 'Canadian',
publisher = '[[Music Canada]]',
} end,
["central america"] = function() return {
title = 'Certificaciones',
publisher = '[[Certificación Fonográfica Centroamericana]]',
language = 'Spanish',
} end,
denmark = function(args)
local note
if args.source ~= 'chart' and not notblank(args.id) then
note = ' Scroll through the page-list below' ..
(notblank(args.certyear) and (' until year ' .. args.certyear) or '') ..
' to obtain certification.'
end
return {
titleRegion = 'Danish',
publisher = '[[IFPI Danmark]]',
note = note
}
end,
europe = function(args)
local certyear = tonumber(args.certyear)
if not certyear then
return 'MISSING OR INVALID certyear WAS PROVIDED FOR EUROPEAN CERTIFICATION.'
end
if certyear >= 2015 then
return 'certyear FOR EUROPEAN CERTIFICATION MUST BE BELOW 2015.'
end
return {
title = 'IFPI Platinum Europe Awards – ' .. args.certyear,
publisher = '[[International Federation of the Phonographic Industry]]',
}
end,
finland = function(args)
if isblank(args.artist) then
return 'NO artist WAS PROVIDED FOR FINLAND CERTIFICATION.'
end
return {
title = 'Kulta- ja platinalevyt - ' .. args.artist,
publisher = '[[Musiikkituottajat|Musiikkituottajat – IFPI Finland]]',
language = 'Finnish',
}
end,
france = function(args)
local publisher = '[[SNEP]]'
local note
if mw.ustring.lower(args.source) == 'infodisc' then
publisher = 'InfoDisc'
if notblank(args.artist) then
note = " ''Select ''" .. mw.ustring.upper(args.artist) .. "'' and click ''OK''. "
end
end
return {
titleRegion = 'French',
publisher = publisher,
language = 'French',
archive = true,
note = note
}
end,
gcc = function(args)
local certyear = tonumber(args.certyear)
if not certyear then
return 'MISSING OR INVALID certyear WAS PROVIDED FOR GCC CERTIFICATION.'
end
if certyear >= 2012 then
return 'certyear FOR GCC CERTIFICATION MUST BE BELOW 2012.'
end
return {
title = 'IFPI Middle East Awards – ' .. args.certyear,
publisher = '[[International Federation of the Phonographic Industry|IFPI]] Middle East',
}
end,
germany = function(args)
if isblank(args.artist) and isblank(args.title) then
return 'AT LEAST ONE OF artist OR title MUST BE PROVIDED FOR GERMAN CERTIFICATION.'
end
local title = 'Gold-/Platin-Datenbank (' .. (args.artist or '') .. (
notblank(args.title) and (
(notblank(args.artist) and ' ' or '') .. "'" .. args.title .. "'"
) or ''
) .. ')'
return {
title = title,
publisher = '[[Bundesverband Musikindustrie]]',
language = 'German',
}
end,
greece = function(args)
if isblank(args.id) then
return 'id MUST BE PROVIDED FOR GREEK CERTIFICATION.'
end
local title
local year = tonumber(args.certyear)
if year and year >= 2021 then
title = 'IFPI Charts – Digital Singles Chart (' .. yesno(args.domestic) and 'Local' or 'International' .. ')'
if notblank(args.certweek) then
title = title .. ' – Εβδομάδα: ' .. args.certweek .. '/' .. args.certyear
end
else
local chart
local type = mw.ustring.lower(args.type or '')
if type == 'album' then
if not year then
chart = 'Top 50 Ξένων Aλμπουμ'
elseif year < 2011 then
chart = 'Top 50 ' .. yesno(args.domestic) and 'Ελληνικών Άλμπουμ' or 'Ξένων Aλμπουμ'
else
chart = 'Top-75 Albums Sales Chart'
end
elseif type == 'single' then
chart = 'Top 50 Singles'
elseif type == 'video' then
chart = 'Top 20 DVD/Video'
end
title = 'Ελληνικό Chart' .. (chart and (' – ' .. chart) or '') ..
((year and notblank(args.certweek)) and (' – Εβδομάδα: ' .. args.certweek .. '/' .. year) or '')
end
return {
title = title,
publisher = '[[IFPI Greece]]',
language = 'Greek',
}
end,
hongkong = function (args)
local year = tonumber(args.certyear)
if not year then
return 'MISSING OR INVALID certyear PROVIDED FOR Hong Kong CERTIFICATION.'
elseif year >= 2009 then
return 'certyear FOR Hong Kong CERTIFICATION MUST BE BEFORE 2009.'
end
return {
title = 'IFPIHK Gold Disc Award − ' .. args.certyear,
publisher = '[[International Federation of the Phonographic Industry|IFPI]] Hong Kong',
}
end,
hungary = function (args)
if not tonumber(args.certyear) then
return 'MISSING OR INVALID certyear WAS PROVIDED FOR HUNGARIAN CERTIFICATION.'
end
return {
title = 'Adatbázis – Arany- és platinalemezek – ' .. args.certyear,
publisher = '[[Association of Hungarian Record Companies|MAHASZ]]',
language = 'Hungarian',
}
end,
ireland = function (args)
if isblank(args.award) then
return 'NO award WAS PROVIDED FOR Ireland CERTIFICATION.'
elseif isblank(args.certyear) then
return 'NO certyear WAS PROVIDED FOR Ireland CERTIFICATION.'
elseif tonumber(args.certyear) >= 2014 then
return 'certyear FOR Ireland CERTIFICATION MUST BE BEFORE 2014.'
end
local award
if mw.ustring.lower(args.award or '') == 'gold' then
award = 'Gold'
elseif notblank(args.number) then
award = 'Multi Platinum'
else
award = 'Platinum'
end
return {
title = 'The Irish Charts - ' .. args.certyear .. ' Certification Awards - ' .. award,
publisher = '[[Irish Recorded Music Association]]',
}
end,
italy = function ()
return {
titleRegion = 'Italian',
publisher = '[[Federazione Industria Musicale Italiana]]',
language = 'Italian',
}
end,
japan = function (args)
local note
local year = tonumber(args.certyear)
if year and notblank(args.certmonth) then
note = "''Select'' " .. args.certyear .. '年' .. args.certmonth .. "月 ''on the drop-down menu''"
end
return {
titleRegion = 'Japanese',
publisher = '[[Recording Industry Association of Japan]]',
language = 'Japanese',
note = note,
}
end,
mexico = function (args)
local note
if notblank(args.artist) or notblank(args.title) then
note = "''Type ''"
if notblank(args.artist) then
note = note .. args.artist .. "'' in the box under the ''ARTISTA'' column heading" ..
(notblank(args.title) and " and ''" or "''.")
end
if notblank(args.title) then
note = note .. args.title .. "'' in the box under the ''TÍTULO'' column heading.''"
end
end
return {
title = 'Certificaciones',
publisher = '[[Asociación Mexicana de Productores de Fonogramas y Videogramas]]',
language = 'Spanish',
note = note,
}
end,
netherlands = function (args)
local note
if notblank(args.artist) or notblank(args.title) then
note = "''Enter ''" .. (notblank(args.title) and args.title or args.artist) ..
"'' in the \"Artiest of titel\" box.''"
end
local certyear = tonumber(args.certyear)
if certyear then
note = (note and (note .. ' ') or '') ..
"''Select'' " .. certyear .. "'' in the drop-down menu saying \"Alle jaargangen\"''."
end
return {
titleRegion = 'Dutch',
publisher = '[[NVPI|Nederlandse Vereniging van Producenten en Importeurs van beeld- en geluidsdragers]]',
language = 'Dutch',
note = note,
}
end,
['new zealand'] = function (args)
local source = mw.ustring.lower(args.source or '')
if source == 'book' then
return {
last1 = 'Scapolo',
first1 = 'Dean',
title = 'The Complete New Zealand Music Charts: 1966 – 2006',
date = '2007',
publisher = 'Maurienne House',
isbn = '978-1877443-00-8',
location = 'Wellington',
page = args.id,
url = args.url,
}
elseif source == 'archive' then
local typ = mw.ustring.lower(args.type or '')
local titleType = ({
single = 'Singles',
album = 'Albums',
video = 'DVDs',
})[typ]
if not titleType then
return 'type FOR New Zealand CERTIFICATION MUST BE "single", "album", OR "video".'
end
return {
title = 'Latest Gold / Platinum ' .. ({
single = 'Singles',
album = 'Albums',
video = 'DVDs',
})[typ],
publisher = 'Radioscope',
date = ({
single = '21 August 2011',
album = '17 July 2011',
video = '3 July 2011',
})[typ],
archive = true,
}
elseif source == 'newchart' then
if isblank(args.type) then
return 'THE FIELD type (album/single/compilation) MUST BE PROVIDED FOR NEW ZEALAND CERTIFICATION.'
elseif isblank(args.id) then
return 'THE FIELD id (chart number) MUST BE PROVIDED FOR NEW ZEALAND CERTIFICATION.'
end
return {
publisher = '[[Recorded Music NZ]]',
}
elseif source == 'radioscope' then
if isblank(args.type) then
return 'THE FIELD type (album/single) MUST BE PROVIDED FOR NEW ZEALAND CERTIFICATION.'
end
local note
if notblank(args.artist) or notblank(args.title) then
note = "''Type ''" .. (notblank(args.title) and args.title or args.artist) ..
"'' in the \"Search:\" field and press Enter.''"
end
return {
urlSource = 'radioscope',
publisher = 'Radioscope',
note = note,
}
end
-- oldchart / default
if isblank(args.type) then
return 'THE FIELD type (album/single/compilation) MUST BE PROVIDED FOR NEW ZEALAND CERTIFICATION.'
elseif isblank(args.id) then
return 'THE FIELD id (chart number) MUST BE PROVIDED FOR NEW ZEALAND CERTIFICATION.'
end
return {
urlSource = 'oldchart',
publisher = '[[Recorded Music NZ]]',
archive = true,
urlStatus = (notblank(args['archive-url']) or notblank(args.archiveurl)) and 'deviated' or nil,
}
end,
nigeria = function ()
return {
titleRegion = 'Nigerian',
publisher = '[[TurnTable]]',
}
end,
norway = function (args)
local title
local certyear = tonumber(args.certyear)
if certyear and certyear >= 1993 and certyear < 2011 then
title = 'IFPI Norsk platebransje Trofeer 1993–2011'
end
return {
title = title,
titleRegion = 'Norwegian',
publisher = '[[International Federation of the Phonographic Industry|IFPI]] Norway',
language = 'Norwegian',
}
end,
philippines = function ()
return {
title = 'List of PARI Gold, Platinum & Diamond Awardees',
publisher = '[[Philippine Association of the Record Industry]]',
}
end,
poland = function (args)
local certyear = tonumber(args.certyear) or 2023
if certyear <= 2022 then
if isblank(args.type) then
return 'type MUST BE PROVIDED FOR Polish CERTIFICATION.'
elseif isblank(args.award) then
return 'award MUST BE PROVIDED FOR Polish CERTIFICATION.'
end
local award = ({
gold = 'Złote',
platinum = 'Platynowe',
diamond = 'Diamentowe',
})[mw.ustring.lower(args.award or '')] or ''
local media = ({
album = 'CD',
single = 'CD',
video = 'DVD',
})[mw.ustring.lower(args.type or '')] or ''
return {
title = 'Wyróżnienia – ' .. award .. ' płyty ' .. media .. ' - Archiwum - Przyznane w ' .. certyear .. ' roku',
publisher = '[[Polish Society of the Phonographic Industry]]',
language = 'Polish',
archive = true,
}
end
if isblank(args.artist) and isblank(args.title) then
return 'artist OR title MUST BE PROVIDED FOR Polish CERTIFICATION.'
end
local note
if notblank(args.title) then
note = "Click \"TYTUŁ\" and enter ''" .. args.title .. "'' in the search box."
else
note = "Click \"WYKONAWCA\" and enter ''" .. args.artist .. "'' in the search box."
end
return {
title = 'OLiS - oficjalna lista wyróżnień',
publisher = '[[Polish Society of the Phonographic Industry]]',
language = 'Polish',
note = note,
}
end,
portugal = function (args)
local certyear = tonumber(args.certyear)
if not certyear and isblank(args.id) then
return 'AT LEAST ONE OF certyear OR id MUST BE PROVIDED FOR Portuguese CERTIFICATION.'
end
if certyear then
if args.source == 'archive' then
if certyear < 2007 or certyear > 2010 then
return 'certyear MUST BE BETWEEN 2007 AND 2010 FOR Portuguese CERTIFICATION WITH source=archive.'
end
else
if isblank(args.id) then
return 'id MUST BE PROVIDED FOR Portuguese CERTIFICATION.'
elseif certyear < 2018 and isblank(args.archiveurl) and isblank(args["archive-url"]) then
return 'archive-url MUST BE PROVIDED FOR Portuguese CERTIFICATION before 2018'
end
end
end
return {
titleRegion = 'Portuguese',
publisher = '[[Associação Fonográfica Portuguesa]]',
language = 'Portuguese',
archive = true,
}
end,
russia = function ()
return {
titleRegion = 'Russian',
publisher = 'National Federation of Phonogram Producers (NFPF)',
language = 'Russian',
}
end,
singapore = function ()
return {
publisher = '[[Recording Industry Association Singapore]]',
}
end,
["south africa"] = function ()
return {
publisher = '[[Recording Industry of South Africa]]',
}
end,
["south korea"] = function (args)
if isblank(args.type) then
return "NO type WAS PROVIDED FOR SOUTH KOREAN CERTIFICATION."
end
return {
titleRegion = 'South Korean',
publisher = '[[Circle Chart|Korea Music Content Association]] (KMCA)',
language = 'Korean'
}
end,
spain = function (args)
if notblank(args.id) then
if isblank(args.type) then
return 'type IS REQUIRED FOR SPANISH CERTIFICATION WHEN id IS USED.'
end
return {
titleRegion = 'Spanish',
publisher = '[[Productores de Música de España]]',
website = 'El portal de Música',
}
end
local certyear = tonumber(args.certyear)
if not isblank(args.certweek) then
if not certyear then
return 'certweek AND certyear ARE REQUIRED FOR SPANISH CERTIFICATION.'
end
local category
local type = mw.ustring.lower(args.type or '')
if type == 'single' then
if yesno(args.streaming) then
category = 'Streaming'
elseif certyear < 2008 then
category = 'Singles'
elseif certyear > 2008 then
category = 'Canciones'
else -- certyear is 2008
category = yesno(args.digital) and 'Canciones' or 'Singles'
end
elseif type == 'ringtone' then
category = 'Canciones'
elseif type == 'album' then
category = 'Álbumes'
else
return 'type MUST BE single, ringtone, OR album FOR SPANISH CERTIFICATION.'
end
return {
titleRegion = 'Spanish',
publisher = '[[Productores de Música de España]]',
language = 'Spanish',
note = "''Select " .. category .. " under \"Categoría\", select ''" ..
certyear .. "'' under \"Año\". Select ''" .. args.certweek ..
"'' under \"Semana\". Click on \"BUSCAR LISTA\".''",
}
end
if isblank(args.artist) and isblank(args.title) then
return 'artist OR title OR id AND type OR certyear AND certweek ARE REQUIRED FOR SPANISH CERTIFICATION.'
end
return {
publisher = '[[Productores de Música de España]]',
website = 'El portal de Música',
}
end,
sweden = function (args)
local source = mw.ustring.lower(args.source or '')
local certyear = tonumber(args.certyear)
if source == 'artist' then
if isblank(args.artist) then
return 'artist REQUIRED FOR SWEDISH CERTIFICATION.'
end
return {
title = 'Sverigetopplistan – ' .. args.artist,
publisher = '[[Sverigetopplistan]]',
language = 'Swedish',
}
elseif source == 'grammotex' then
if isblank(args.id) then
return 'id REQUIRED FOR SWEDISH CERTIFICATION FROM Grammotex.'
end
return {
title = 'Grammotex – Artikeldata' ..
(notblank(args.artist) and (' Artist: ' .. args.artist) or '') ..
(notblank(args.title) and (' Titel: ' .. args.title) or ''),
publisher = 'Grammotex',
language = 'Swedish',
}
elseif source == 'chart' then
if not certyear then
return 'certyear IS REQUIRED FOR SWEDISH CERTIFICATIONS'
end
end
if certyear then
if source == 'chart' or certyear > 2011 then
local typ = mw.ustring.lower(args.type or '')
if isblank(args.certweek) then
return 'certweek IS REQUIRED FOR SWEDISH CERTIFICATIONS.'
elseif typ ~= 'single' and typ ~= 'album' then
return 'UNSUPPORTED type VALUE. type MUST BE EITHER "single" OR "album".'
end
return {
urlSource = 'chart',
title = 'Veckolista ' .. (typ == 'single' and 'Singlar' or 'Album') ..
', vecka ' .. args.certweek .. ', ' .. certyear .. ' | Sverigetopplistan',
publisher = '[[Sverigetopplistan]]',
language = 'Swedish',
note = notblank(args.position) and
("''Scroll to position " .. args.position .. " to view certification.''") or nil,
}
end
return {
title = 'Guld- och Platinacertifikat ' ..
(certyear < 1999 and '− År 1987−1998' or ('− År ' .. certyear)),
publisher = '[[International Federation of the Phonographic Industry|IFPI Sweden]]',
language = 'Swedish',
format = 'PDF',
archive = true,
note = notblank(args.position) and
("''Scroll to position " .. args.position .. " to view certification.''") or nil,
}
end
if isblank(args.artist) then
return 'artist or certyear REQUIRED FOR SWEDISH CERTIFICATION.'
end
return {
urlSource = 'artist',
title = 'Sverigetopplistan – ' .. args.artist,
publisher = '[[Sverigetopplistan]]',
language = 'Swedish',
}
end,
switzerland = function (args)
if isblank(args.artist) and isblank(args.title) and not tonumber(args.certyear) then
return 'AT LEAST ONE OF artist, title or certyear MUST BE PROVIDED for SWISS CERTIFICATION.'
end
local title = 'The Official Swiss Charts and Music Community: Awards'
if notblank(args.title) then
title = title .. " ('" .. args.title .. "')"
elseif notblank(args.artist) then
title = title .. ' (' .. args.artist .. ')'
elseif tonumber(args.certyear) then
title = title .. ' ' .. args.certyear
end
return {
title = title,
publisher = 'IFPI Switzerland. Hung Medien',
}
end,
turkey = function (args)
local certyear = tonumber(args.certyear)
if not certyear then
return 'MUST LIST certyear FOR TURKISH CERTIFICATION.'
end
return {
title = certyear .. ' Mü-Yap Müzik Endüstrisi Ödülleri',
publisher = '[[Mü-Yap]]',
language = 'Turkish',
archive = true,
}
end,
taiwan = function ()
return {
publisher = '[[Recording Industry Foundation in Taiwan]]',
language = 'Chinese',
scriptTitle = 'zh:認證紀錄',
transTitle = 'Certifications Awarded',
}
end,
['united kingdom'] = function (args)
if isblank(args.artist) and isblank(args.title) then
return 'artist OR title MUST BE PROVIDED for UK CERTIFICATION.'
end
local note = notblank(args.type) and ("''Select ''" .. args.type .. "s'' in the Formats field.'' ") or ''
note = note .. "''Type ''"
if notblank(args.title) then
note = note .. args.title .. (notblank(args.artist) and ' ' or '')
end
if notblank(args.artist) then
note = note .. args.artist
end
note = note .. "'' in the \"Search:\" field.''"
return {
titleRegion = 'British',
publisher = '[[British Phonographic Industry]]',
note = note,
}
end,
['united states'] = function ()
return {
titleRegion = 'American',
publisher = '[[Recording Industry Association of America]]',
}
end,
uruguay = function (args)
local certyear = tonumber(args.certyear)
if not certyear then
return 'MUST LIST certyear FOR URUGUAY CERTIFICATION.'
end
return {
title = 'Premios – ' .. certyear,
publisher = 'Cámara Uruguaya del Disco',
language = 'Spanish',
}
end,
}