Module:Musiquecharts
Apparence
La documentation de ce module est générée par le modèle {{Documentation module}}.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
p = {}
-- ISO country codes with country name (1), chart link (2), abbreviated chart publisher (3), certification publisher link (4), abbreviated certification publisher (5), no. 1 list ID (6), no. 1 list colour scheme (7)
countrytable = {
["AUT"] = { "Österreich", "Ö3 Austria Top 40", "Ö3", "IFPI Austria – Verband der Österreichischen Musikwirtschaft", "IFPI", "Österreich" },
["ARG"] = { "Argentinien", "Argentinien", "CAPIF", "Cámara Argentina de Productores de Fonogramas y Videogramas", "CAPIF", "Argentinien", "2" },
["AUS"] = { "Australien", "Australische Musikcharts", "ARIA", "Australian Recording Industry Association", "ARIA", "Australien" },
["BEL"] = { "Belgien", "Ultratop", "Ultratop", "Belgian Entertainment Association", "BEA", "Belgien", "3" },
["BGR"] = { "Bulgarien", "Bulgarien", "BAMP", "Bulgarian Association of the Music Producers", "BAMP", "Bulgarien", "4" },
["BRA"] = { "Brasilien", "Brasilien", "PMB", "Pró-Música Brasil", "PMB", "4" },
["CAN"] = { "Kanada", "Kanadische Musikcharts", "MC", "Music Canada", "MC", "Kanada" },
["CHE"] = { "Schweiz", "Schweizer Hitparade", "IFPI", "IFPI Schweiz", "IFPI", "der Schweiz" },
["CHL"] = { "Chile", "Chile", "", "IFPI Chile", "IFPI" },
["COL"] = { "Kolumbien", "Kolumbien", "", "Asociación Colombiana de Productores de Fonogramas", "ASINCOL" },
["CZE"] = { "Tschechien", "Tschechien", "IFPI", "IFPI Tschechien", "IFPI", "Tschechien" },
["DEU"] = { "Deutschland", "Deutsche Musikcharts", "GfK", "Bundesverband Musikindustrie", "BVMI", "Deutschland", "3" },
["DNK"] = { "Dänemark", "Hitlisten (dänische Musikcharts)", "IFPI/Nielsen", "IFPI Dänemark", "IFPI", "Dänemark" },
["ECU"] = { "Ecuador", "Ecuador", "", "Sociedad de Productores de Fonogramas", "SOPROFON" },
["ESP"] = { "Spanien", "Spanische Musikcharts", "Promusicae", "Productores de Música de España", "Promusicae", "Spanien", "3" },
["EUR"] = { "Europa", "Europa", "", "International Federation of the Phonographic Industry", "IFPI" },
["FIN"] = { "Finnland", "Finnische Musikcharts", "IFPI", "Musiikkituottajat – IFPI Finland", "IFPI", "Finnland" },
["FRA"] = { "Frankreich", "Frankreich", "SNEP", "Syndicat National de l’édition Phonographique", "SNEP", "Frankreich" },
["GRC"] = { "Griechenland", "IFPI Griechenland#Musikcharts", "IFPI", "IFPI Griechenland", "IFPI", "Griechenland", "2" },
["HKG"] = { "Hongkong", "Hongkong", "", "IFPI Hong Kong Group", "IFPI/HKRIA" },
["HUN"] = { "Ungarn", "Ungarn", "MAHASZ", "Magyar Hanglemezkiadók Szövetsége", "MAHASZ", "Ungarn", "4" },
["HRV"] = { "Kroatien", "Kroatien", "HDU", "Hrvatska diskografska udruga", "HDU", "Kroatien" },
["IDN"] = { "Indonesien", "Indonesien", "", "Asosiasi Industri Rekaman Indonesia", "ASIRI" },
["IND"] = { "Indien", "Indien", "", "The Indian Music Industry", "IMI" },
["IRL"] = { "Irland", "Irische Musikcharts", "IRMA", "Irish Recorded Music Association", "IRMA", "Irland", "4" },
["ISL"] = { "Island", "Island", "", "IFPI Island", "IFPI" },
["ITA"] = { "Italien", "Italienische Musikcharts", "FIMI", "Federazione Industria Musicale Italiana", "FIMI", "Italien", "4" },
["JPN"] = { "Japan", "Oricon#Oricon-Charts", "Oricon", "Recording Industry Association of Japan", "RIAJ", "Japan" },
["KOR"] = { "Südkorea", "Gaon Chart", "KMCA", "Korea Music Content Association", "KMCA", "Südkorea" },
["LBN"] = { "Libanon", "Libanon", "", "IFPI Middle East Awards", "IFPI" },
["LVA"] = { "Lettland", "Lettland", "", "Latvian Music Producers Association", "LaMPA" },
["MEX"] = { "Mexiko", "Mexiko", "AMPROFON", "Asociación Mexicana de Productores de Fonogramas y Videogramas", "AMPROFON", "Mexiko", "4" },
["MYS"] = { "Malaysia", "Malaysia", "RIM", "Recording Industry Association of Malaysia", "RIM", "Malaysia" },
["NLD"] = { "Niederlande", "Niederländische Musikcharts", "Media Markt / Dutch Charts", "Nederlandse Vereniging van Producenten en Importeurs van beeld- en geluidsdragers", "NVPI", "den Niederlanden" },
["NOR"] = { "Norwegen", "Norwegische Musikcharts", "Nielsen", "IFPI Norwegen", "IFPI", "Norwegen" },
["NZL"] = { "Neuseeland", "Neuseeländische Musikcharts", "RMNZ", "Recorded Music NZ", "RMNZ"; "Neuseeland" },
["PER"] = { "Peru", "Peru", "", "Unión Peruana de Productores Fonográficos", "UNIMPRO" },
["PHL"] = { "Philippinen", "Philippinen", "", "Kapisanan ng Industriya ng Plaka ng Pilipinas", "PARI" },
["POL"] = { "Polen", "Związek Producentów Audio-Video#Musikcharts", "ZPAV", "Związek Producentów Audio-Video", "ZPAV", "Polen", "5" },
["PRT"] = { "Portugal", "Associação Fonográfica Portuguesa#Musikcharts", "AFP", "Associação Fonográfica Portuguesa", "AFP", "Portugal", "4" },
["ROU"] = { "Rumänien", "Uniunea Producătorilor de Fonograme din România", "UFPR", "Uniunea Producătorilor de Fonograme din România", "UFPR", "Rumänien" },
["RUS"] = { "Russland", "Russland", "", "National Federation of Phonograph Producers", "NFPF" },
["SVK"] = { "Slowakei", "Slowakei", "IFPI", "IFPI Tschechien", "IFPI", "der Slowakei" },
["SWE"] = { "Schweden", "Schwedische Musikcharts", "GLF", "IFPI Schweden", "IFPI", "Schweden" },
["SGP"] = { "Singapur", "Singapur", "RIAS", "Recording Industry Association (Singapore)", "RIAS", "Singapur" },
["THA"] = { "Thailand", "Thailand", "", "Thai Entertainment Content Trade Association", "TECA" },
["TUR"] = { "Türkei", "Türkei", "", "Bağlantılı Hak Sahibi Fonogram Yapımcıları Meslek Birliği", "MÜ-YAP" },
["TWN"] = { "Taiwan", "Republik China (Taiwan)", "", "Recording Industry Foundation in Taiwan", "RIT" },
["GBR"] = { "Vereinigtes Königreich", "UK Music Charts", "OCC", "British Phonographic Industry", "BPI", "den britischen Charts" },
["USA"] = { "Vereinigte Staaten", "Billboard (Magazin)#Billboard-Charts", "Billboard", "Recording Industry Association of America", "RIAA", "den USA" },
["URY"] = { "Uruguay", "Uruguay", "", "Cámara Uruguaya del Disco", "CUD" },
["VEN"] = { "Venezuela", "Venezuela", "", "Association of Venezuelan Phonograph Producers", "APFV" },
["ZAF"] = { "Südafrika", "Südafrika", "", "The Recording Industry of South Africa", "RISA"},
-- special cases
["EUR2"] = { "Europa", "Europa", "", "Impala (Verband)#Impala Music Awards", "Impala" },
["GCC"] = { "Golf-Kooperationsrat", "Golf-Kooperationsrat", "", "IFPI Middle East Awards", "IFPI" },
["BEF"] = { "Flandern", "Ultratop", "Ultratop", "Belgian Entertainment Association", "BEA", "Belgien", "3" },
["BEW"] = { "Wallonie", "Ultratop", "Ultratop", "Belgian Entertainment Association", "BEA", "Belgien", "3" },
["DEU-A"] = { "Deutschland", "Deutsche Albumcharts", "GfK", "Bundesverband Musikindustrie", "BVMI", "Deutschland", "3" },
["DEU-S"] = { "Deutschland", "Deutsche Singlecharts", "GfK", "Bundesverband Musikindustrie", "BVMI", "Deutschland", "3" },
["NLD-A"] = { "Niederlande", "MegaCharts", "Dutch Charts", "Nederlandse Vereniging van Producenten en Importeurs van beeld- en geluidsdragers", "NVPI", "den Niederlanden" },
["NLD-S"] = { "Niederlande", "Nederlandse Top 40", "Media Markt", "Nederlandse Vereniging van Producenten en Importeurs van beeld- en geluidsdragers", "NVPI", "den Niederlanden" },
["USA-A"] = { "Vereinigte Staaten", "Billboard 200", "Billboard", "Recording Industry Association of America", "RIAA", "den USA" },
["USA-S"] = { "Vereinigte Staaten", "Billboard Hot 100", "Billboard", "Recording Industry Association of America", "RIAA", "den USA" }
}
-- colour schemes for countries in no1 table and related templates
colourtable = {
["1"] = { "#5D80D0", "#9DB8F0", "#E9F0FF" },
["2"] = { "#7BC5F7", "#C8E8FD", "#E4F4FF" },
["3"] = { "#FFF090", "#FFFBB9", "#FFFBED" },
["4"] = { "#3ACD3A", "#8AFC8A", "#E9FFE9" },
["5"] = { "#EE6363", "#FF6A6A", "#FFC1C1" }
}
-- Länderspalten für Charttabellen - country columns in chart table head
p.countryhead = function (frame, countries, rformat, year)
local ret = ""
for c = 1, #countries.countries do
local country = countries.countries[c]
local countryconv = frame:expandTemplate{ title = 'ISO3166-A3-Conversion', args = { country } }
local countrycode = countrytable[countryconv] or countrytable[country]
if countryconv == "NLD" then
if countries.rformat == "Singles" then
countrycode = countrytable["NLD-S"]
else
countrycode = countrytable["NLD-A"]
end
elseif countryconv == "USA" then
if countries.rformat == "Singles" then
countrycode = countrytable["USA-S"]
else
countrycode = countrytable["USA-A"]
end
elseif countryconv == "DEU" then
if countries.rformat == "Singles" then
countrycode = countrytable["DEU-S"]
else
countrycode = countrytable["DEU-A"]
end
end
ret = ret .. "\n! style='width:52px;background-color:#FFEBAD;' data-sort-type='number' | "
if not countrycode then
ret = ret .. country
else
ret = ret .. "{{"
-- country code for flag template
if country == "BEF" then
ret = ret .. "BE-VLG"
elseif country == "BEW" then
ret = ret .. "BE-WAL"
else
ret = ret .. countryconv
end
-- chart link
ret = ret .. "|" .. countrycode[2] .. "|"
-- displayed link text
if country == "BEF" then
ret = ret .. "BE<sup>F</sup>"
elseif country == "BEW" then
ret = ret .. "BE<sup>W</sup>"
elseif countryconv == "BEL" and (tonumber(countries.year) or 0) > 1994 then
ret = ret .. "BE<div style='display:none;'>[[Vorlage:Charttabelle/Wartung/Belgien]]</div>"
else
ret = ret .. frame:expandTemplate{ title = 'ISO3166-A2-Konversion', args = { country } }
end
ret = ret .. "}}"
end
end
return ret
end
-- Charttabelle - chart table
p.charttablehead = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local countries = {}
local i = 0
for k, v in ipairs (parameters) do
v = mw.text.trim( v )
if #v > 0 then
i = i + 1
countries[i] = v
end
end
local source = parameters.Quellen
local rformat = parameters.Art
local legend = parameters.Legende
local sortable = parameters.sortierbar
local extra = parameters.Extra
local titleaddition = parameters.TitelErg
local content = parameters.INHALT or ""
local tablewidth = {
["1"] = { "250", "320" },
["1e"] = { "245", "220", "175" },
["2"] = { "300", "320" },
["2e"] = { "285", "220", "175" },
["3"] = { "350", "300" },
["3e"] = { "315", "210", "160" },
["4"] = { "400", "270" },
["4e"] = { "345", "200", "160" }
}
local width = "1"
if tablewidth[parameters.Breite] then
width = parameters.Breite
end
if extra then
width = width .. "e"
end
local ret = "<templatestyles src='Vorlage:Charttabelle/styles.css' />"
if legend then
ret = ret .. "<span style='font-size:smaller;font-style:italic;'>Jahr: Jahr der ersten Chartplatzierung; Chartpositionen: Höchstplatzierung und Gesamtwochenanzahl des Chartaufenthalts (…: noch in den Charts befindlich); Anmerkungen: Auszeichnungen mit Anzahl verkaufter Einheiten.</span>"
end
ret = ret .. "\n{| class='wikitable"
if sortable then
ret = ret .. " sortable"
end
ret = ret .. " charts-zebragrey' style='text-align:center; background-color:#E1E9F3' \n|-"
ret = ret .. "\n! style='width:25px;background-color:#FFEBAD;' rowspan='2' | Jahr"
ret = ret .. "\n! style='width:" .. tablewidth[width][1] .. "px;background-color:#FFEBAD;' rowspan='2'| Titel"
if titleaddition then
ret = ret .. "<br /><span style='font-size:smaller;font-style:italic;'>" .. titleaddition .. "</span>"
elseif rformat == "Singles" then
ret = ret .. "<br /><span style='font-size:smaller;font-style:italic;'>Album</span>"
end
ret = ret .. "\n! style='background-color:#FFEBAD;' colspan='" .. #countries .. "'|"
if #countries > 1 then
ret = ret .. " Chart"
else
ret = ret .. " Charts"
end
ret = ret .. (source or "<div style='display:none'>[[Vorlage:Charttabelle/Wartung/ohne Quellen]]</div>") .. "\n! style='width:" .. tablewidth[width][2] .. "px;background-color:#FFEBAD;' rowspan='2' class='unsortable' | Anmerkungen"
if extra then
ret = ret .. "\n! style='width:" .. tablewidth[width][3] .. "px;background-color:#FFEBAD;' rowspan='2' class='unsortable' |" .. extra
end
ret = ret .. "\n|-"
-- country columns
ret = ret .. p.countryhead( frame, {countries = countries, rformat = rformat, year = year } )
ret = ret .. "\n|- \n" .. content .. "\n|- \n|}"
return frame:preprocess (ret)
end
-- Chartauswertung - chart statistics
p.chartstatistics = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local countries = {}
local i = 0
for k, v in ipairs (parameters) do
v = mw.text.trim( v )
if #v > 0 then
i = i + 1
countries[i] = v
end
end
if #countries > 8 then return "Too many countries" end
local rformat = parameters.Art
local comment = parameters.Anmerkung
local istable = parameters.Tabelle
local ret = nil
if istable then
ret = "{| class='wikitable charts-zebragrey2' style='text-align:center;' \n |- \n ! style='width:200px; background-color:#FFEBAD;' |"
-- country columns
ret = ret .. p.countryhead( frame, {countries = countries, rformat = rformat } )
ret = ret .. "\n|-"
else
ret = "|- class='sortbottom charts-redstats'\n| rowspan='3'|"
end
ret = ret .. "\n| style='text-align:left;'|"
if rformat then
ret = ret .. "Nummer-eins-" .. rformat
else
ret = ret .. "Nummer eins"
end
for c = 1, #countries do
local n = "NR1_" .. countries[c]
local No1 = parameters[n]
if No1 == "" or No1 == nil then
ret = ret .. "\n| " .. "—"
else
ret = ret .. "\n| " .. No1
end
end
if not istable then
ret = ret .. "\n| rowspan='3' colspan='2' style='text-align:left; font-size:smaller;' |"
if comment then
ret = ret .. comment
end
end
ret = ret .. "\n|- "
if not istable then
ret = ret .. "class='sortbottom charts-redstats' "
end
ret = ret .. "\n| style='text-align:left;'|"
if rformat then
ret = ret .. "Top-10-" .. rformat
else
ret = ret .. "in den Top 10"
end
for c = 1, #countries do
local t = "T10_" .. countries[c]
local Top10 = parameters[t]
if Top10 == "" or Top10 == nil then
ret = ret .. "\n| " .. "—"
else
ret = ret .. "\n| " .. Top10
end
end
ret = ret .. "\n|- "
if istable then
ret = ret .. "style='background:#FBF8D6; font-weight:bold;'"
else
ret = ret .. "class='sortbottom charts-redstats'"
end
ret = ret .. "\n| style='text-align:left;'|" .. (rformat or "") .. " in den Charts"
for c = 1, #countries do
local g = "INSG_" .. countries[c]
local Total = parameters[g]
if Total == "" or Total == nil then
ret = ret .. "\n| " .. "—"
else
ret = ret .. "\n| " .. Total
end
end
if istable then
ret = ret .. "\n|}"
end
return frame:preprocess (ret)
end
-- Charteintrag - chart table entry
p.charttablerow = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local countries = {}
local i = 0
for k, v in ipairs (parameters) do
v = mw.text.trim( v )
if #v > 0 then
i = i + 1
countries[i] = v
end
end
local year = parameters.Jahr
local colour = parameters.Farbe
local temporary = "<div style='display:none'>[[Vorlage:Charttabelle/Wartung/vorläufig"
if tonumber(year) then
if tonumber(year) > 2009 then
temporary = temporary .. "/" .. year
end
end
temporary = temporary .. "]]</div>"
-- There may be "Titel" instead of "Titel1"
if parameters["Titel"] then
parameters["Farbe1"] = parameters["Farbe"]
parameters["Titel1"] = parameters["Titel"]
parameters["Album1"] = parameters["Album"]
parameters["TitelErg1"] = parameters["TitelErg"]
for c = 1, #countries do
local p = "POS_" .. countries[c]
local p1 = "POS_" .. countries[c] .. "1"
parameters[p1] = parameters[p]
local w = "WO_" .. countries[c]
local w1 = "WO_" .. countries[c] .. "1"
parameters[w1] = parameters[w]
local m = "MT_" .. countries[c]
local m1 = "MT_" .. countries[c] .. "1"
parameters[m1] = parameters[m]
local y = "Jahr_" .. countries[c]
local y1 = "Jahr_" .. countries[c] .. "1"
parameters[y1] = parameters[y]
local s = "Spalten_" .. countries[c]
local s1 = "Spalten_" .. countries[c] .. "1"
parameters[s1] = parameters[s]
local z = "Zeilen_" .. countries[c]
local z1 = "Zeilen_" .. countries[c] .. "1"
parameters[z1] = parameters[z]
local a = "A_" .. countries[c]
local a1 = "A_" .. countries[c] .. "1"
parameters[a1] = parameters[a]
end
parameters["Anmerkung1"] = parameters["Anmerkung"]
parameters["Extra1"] = parameters["Extra"]
parameters["Zeilen_Extra1"] = parameters["Zeilen_Extra"]
end
local rows = 0
repeat
rows = rows + 1
local title = "Titel" .. rows
until not parameters[title]
rows = rows - 1
if rows == 0 then return "Add some rows" end
if #countries > 8 then return "Too many countries" end
local ret = "|-"
-- fallback for row colours, overwriting CSS zebra style (first row)
if colour == "1" then
ret = ret .. " style='background:#eeeeee;'"
elseif colour == "0" then
ret = ret .. " style='background:#e1e9f3;'"
end
ret = ret .. "\n | rowspan='" .. rows .. "' style='background-color:#f0f0ff;' | " .. (year or "")
if year then
if not string.match (year, "^%d%d%d%d$") then
ret = ret .. "<div style='display:none'>[[Vorlage:Charttabelle/Wartung/Jahr]]</div>"
end
end
for row = 1, rows do
local t = "Titel" .. row
local title = parameters[t]
local a = "Album" .. row
local album = parameters[a]
local ta = "TitelErg" .. row
local titleaddition = parameters[ta]
local co = "Farbe" .. row
local rowcolour = parameters[co]
if row > 1 then
ret = ret .. "\n|-"
-- individual row colours, overwriting everything
if rowcolour == "1" then
ret = ret .. " style='background:#eeeeee;'"
else
if rowcolour == "0" then
ret = ret .. " style='background:#e1e9f3;'"
else
-- fallback for row colours, overwriting CSS zebra style (other rows)
--check if even
if row % 2 == 0 then
if colour == "0" then
ret = ret .. " style='background:#eeeeee;'"
elseif colour == "1" then
ret = ret .. " style='background:#e1e9f3;'"
end
-- if odd
else
if colour == "0" then
ret = ret .. " style='background:#e1e9f3;'"
elseif colour == "1" then
ret = ret .. " style='background:#eeeeee;'"
end
end
end
end
end
ret = ret .. "\n| style='text-align:left;' | " .. title .. "<br><span style='font-style:italic;font-size:smaller;'>" .. (album or titleaddition or "") .. "</span>"
for c = 1, #countries do
local p = "POS_" .. countries[c] .. row
local position = parameters[p]
if position ~= "n" then
local w = "WO_" .. countries[c] .. row
local weeks = parameters[w]
local m = "MT_" .. countries[c] .. row
local months = parameters[m]
local y = "Jahr_" .. countries[c] .. row
local year1 = parameters[y]
local s = "Spalten_" .. countries[c] .. row
if parameters[s] and #parameters[s] == 0 then parameters[s] = nil end
local z = "Zeilen_" .. countries[c] .. row
if parameters[z] and #parameters[z] == 0 then parameters[z] = nil end
local a = "A_" .. countries[c] .. row
local certification = parameters[a]
local certref
if certification then
if string.match (certification, "ref") then
certref = string.match (certification, "[%a%d%s%+%(%)]*(.+)")
end
end
ret = ret .. "\n|"
if parameters[s] then
ret = ret .. " colspan='" .. parameters[s] .. "'"
end
if parameters[z] then
ret = ret .. " rowspan='" .. parameters[z] .. "'"
end
if parameters[s] or parameters[z] then
ret = ret .. " | "
end
local certicon
if certification then
certicon = require ("Modul:Musikcharts/AfM-Icon")
certification = " " .. certicon.certicon(frame, certification) .. (certref or "")
else
certification = ""
end
if position then
if string.match(position, "^%[%[Liste") then
ret = ret .. "<div style='display:none;'>[[Vorlage:Charttabelle/Wartung/POS verlinkt]]</div>"
end
if string.match(position, "%[%[Datei%:") or string.match(position, "%[%[File%:") or string.match(position, "%[%[Bild%:") then
ret = ret .. "<div style='display:none;'>[[Vorlage:Charttabelle/Wartung/AfM-Dateien]]</div>"
end
-- create automatic links to lists of number-one hits in selected countries
if position == "1" or string.match(position, "^1%D") then
local country = countries[c]
local countryconv = frame:expandTemplate{ title = 'ISO3166-A3-Conversion', args = { country } }
local countrycode = countrytable[countryconv] or countrytable[country]
if countrycode then
if countrycode[6] then
position = "[[Liste der Nummer-eins-Hits in " .. countrycode[6] .. " (" .. (year1 or year or "") .. ")|<b>1</b>]]" .. (string.match(position, "1(.*)") or "")
else
position = "<b>1</b>" .. (string.match(position, "1(.*)") or "")
end
else
position = "<b>1</b>" .. (string.match(position, "1(.*)") or "")
end
end
if position == "" then
ret = ret .. "<span style='display:none;'>300!</span>—" .. certification
else
if weeks then
if weeks == "n" then
ret = ret .. position .. certification
else
if weeks == "" then
ret = ret .. position .. certification .. "<br><span style='font-size:smaller;'>(… Wo.)</span>" .. temporary
else
ret = ret .. position .. certification .. "<br><span style='font-size:smaller;'>(" .. weeks .. " Wo.)</span>"
end
end
else
if months then
if months == "n" then
ret = ret .. position .. certification
else
if months == "" then
ret = ret .. position .. certification .. "<br><span style='font-size:smaller;'>(… Mt.)</span>" .. temporary
else
ret = ret .. position .. certification .. "<br><span style='font-size:smaller;'>(" .. months .. " Mt.)</span>"
end
end
else
if position then
ret = ret .. position .. certification .. "<br><span style='font-size:smaller;'>(… Wo.)</span>" .. temporary
end
end
end
end
else
ret = ret .. "<span style='display:none;'>300!</span>—" .. certification
end
end
end
local com = "Anmerkung" .. row
local comment = parameters[com]
ret = ret .. "\n| style='text-align:left;' |"
if comment then
ret = ret .. "<div style='font-size:smaller;'>\n" .. comment .. "</div>"
end
local x = "Extra" .. row
local extra = parameters[x]
local zx = "Zeilen_Extra" .. row
if extra then
if parameters[zx] then
ret = ret .. "\n| rowspan='" .. parameters[zx] .. "' style='text-align:left;' | " .. extra
else
ret = ret .. "\n| style='text-align:left;' | " .. (extra or "")
end
end
end
return ret
end
-- Chart - chart positions table
p.chartposhead = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local entry = {}
for k, v in ipairs (parameters) do
entry [k] = v
end
local rows = 0
repeat
rows = rows + 1
local entry = "" .. rows
until not parameters[entry]
rows = rows - 1
local ret = "{| class='wikitable'"
local title = parameters.Titel
local year = parameters.Jahr
if title then
ret = ret .. "\n|+ " .. title
end
ret = ret .. "\n|- \n! style='width:250px;background-color:#FFEBAD;'| Charts"
if year then
ret = ret .. " (" .. year .. ") \n! style='width:90px;background-color:#FFEBAD;' | Platzierung"
else
ret = ret .. "\n! style='width:150px;background-color:#FFEBAD;' | Höchstplatzierung \n! style='width:90px;background-color:#FFEBAD;' | Wochen"
end
-- single rows
ret = ret .. "\n|- style='background:#E1E9F3;'"
for row = 1, rows do
ret = ret .. "\n" .. entry[row]
-- even rows should have different colour from odd rows
if row % 2 == 1 then
ret = ret .. "\n|- style='background:#EEEEEE;'"
else
ret = ret .. "\n|- style='background:#E1E9F3;'"
end
end
ret = ret .. "\n|}"
return ret
end
-- Charts - chart positions table entry
p.chartposrow = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local countryraw = parameters[1]
local country = string.match (parameters[1], "(.*)%s%(.*%)") or countryraw
local brackets = string.match (parameters[1], ".*%s(%(.*%))")
local countryconv = frame:expandTemplate{ title = 'ISO3166-A3-Conversion', args = { country } }
local countrycode = countrytable[countryconv] or countrytable[country]
local position = parameters[2]
local weeks = parameters[3]
local ref = parameters.Q
local year = parameters.Jahr
local ret = "| "
-- template code for country display
local countrydisplay = "{{"
if countrycode then
if country == "BEF" then
countrydisplay = countrydisplay .. "BE-VLG"
elseif country == "BEW" then
countrydisplay = countrydisplay .. "BE-WAL"
elseif string.match (country, "^NLD" ) then
countrydisplay = countrydisplay .. "NLD"
elseif string.match (country, "^USA" ) then
countrydisplay = countrydisplay .. "USA"
elseif string.match (country, "^DEU" ) then
countrydisplay = countrydisplay .. "DEU"
else
countrydisplay = countrydisplay .. countryconv
end
countrydisplay = countrydisplay .. "|" .. countrycode[2] .. "|" .. countrycode[1] .. " (" .. countrycode[3] .. ")}}"
else
countrydisplay = countrydisplay .. country .. "}}"
end
if brackets then
if countrycode then
countrydisplay = countrydisplay:gsub ("%(.*%)", brackets )
else
countrydisplay = countrydisplay:gsub ("}}", " " .. brackets .. "}}")
end
end
ret = ret .. countrydisplay
-- sources
ret = ret .. (ref or "")
-- chart position
local numberone = nil
if countrycode then
numberone = countrycode[6]
end
local numberonelink = nil
if numberone then
numberonelink = "Liste der Nummer-eins-Hits in " .. numberone
if year then
numberonelink = numberonelink .. " (" .. year .. ")"
end
end
ret = ret .. "\n| style='text-align:center;' |"
if position then
if position == "1" or string.match(position, "^1%D") then
if numberonelink then
position = "<b>[[" .. numberonelink .. "|1]]</b>" .. (string.match(position, "1(.*)") or "")
else
position = "<b>1</b>" .. (string.match(position, "1(.*)") or "")
end
end
ret = ret .. position
end
-- weeks on chart
if weeks then
if weeks == "" then weeks = "…" .. "<div style='display:none'>[[Vorlage:Chart/Wartung/vorläufig]]</div>" end
ret = ret .. "\n| style='text-align:center;' |" .. weeks
end
return frame:preprocess (ret)
end
-- Infobox Chart - chart positions infobox
p.chartinfobox = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end -- always [?]
local file = parameters.Bild
local caption = parameters.Bildbeschreibung
local temporary = parameters["vorläufige Chartplatzierung"]
local temporaryweeks = nil
local albums = parameters.Alben
local eps = parameters.EPs
local singles = parameters.Singles
local dvds = parameters.DVDs
local rformats = { albums, eps, singles, dvds }
local titles = {"Alben", "EPs", "Singles", "DVDs"}
local refalbums = parameters["Quellen Alben"]
local refeps = parameters["Quellen EPs"]
local refsingles = parameters["Quellen Singles"]
local refdvds = parameters["Quellen DVDs"]
local refs = { refalbums, refeps, refsingles, refdvds }
local source = parameters.Quellen
for temp = 1, 4 do
if rformats[temp] then
if string.match (rformats[temp], "%(…" ) then
temporaryweeks = true
end
end
end
local ret = "<div>\n{| class='float-right' style='background-color:#FFFFFF; width:208px; border:1px solid #DDD;' \n|-"
if file then
if file ~= "" then
ret = ret .. "\n| [[Datei:" .. file .. "|200px|" .. (caption or mw.title.getCurrentTitle().text) .. "]]"
if caption then
if caption ~= "" then
ret = ret .. "\n|- \n| style='text-align:center; font-size:smaller;' | " .. caption
end
end
end
end
ret = ret .. "\n|- \n| style='background-color:#F3F3F3; text-align:center;' | <span style='font-size:20px; font-stretch:condensed'>Chart</span>"
if temporaryweeks then
ret = ret .. "<br /><span style='font-size:12px; font-stretch:condensed;'>(vorläufig)</span>"
end
ret = ret .. "<br /><span style='font-size:smaller;'>[[Wikipedia:Classement musical|Détail des données]]</span>"
for section = 1, 4 do
if rformats[section] then
if rformats[section] ~= "" then
ret = ret .. "\n|- style='background:#EAECF0;' \n| style='padding:0 .3em;' | <span style='font-size:larger; font-weight:bold;'>" .. titles[section] .. "</span>" .. (refs[section] or "")
ret = ret .. "\n|- \n| style='padding:0 .3em .5em .3em;' | \n{| style='border-collapse:collapse;width:100%;' \n" .. rformats[section] .. "\n|}"
end
end
end
ret = ret .. "\n|}</div>"
if source then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/Quellen-Parameter]]</div>"
elseif not refalbums and not refsingles and not refeps and not refdvds then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/ohne Quellen]]</div>"
end
if temporary then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/vorläufige Chartplatzierung]]</div>"
end
return ret
end
-- Infobox Chart/Werk - chart positions infobox entry
p.chartinfoboxentry = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local templatename = frame:getParent():getTitle()
local rformat = string.match (templatename, "Vorlage:(%a*)")
local rows = {}
local i = 0
for k, v in ipairs (parameters) do
local chartlinksub = { ["US"] = { "Billboard Hot 100", "Billboard 200" }, ["NL"] = { "Nederlandse Top 40", "MegaCharts" }, ["DE"] = { "Deutsche Singlecharts", "Deutsche Albumcharts" } }
local index = nil
if rformat == "Single" then index = 1 else index = 2 end
v = string.gsub (v, "Billboard %(Magazin%)#Billboard%-Charts", chartlinksub["US"][index])
v = string.gsub (v, "Niederländische Musikcharts", chartlinksub["NL"][index])
v = string.gsub (v, "Deutsche Musikcharts", chartlinksub["DE"][index])
if #v > 0 then
i = i + 1
rows[i] = v
end
end
local ret = "\n|- \n| colspan='6' style='font-size:95%;font-weight:bold;' |" .. (rows[1] or "")
for row = 2, #rows do
ret = ret .. "\n|- style='background:#F3F3F3;' \n" .. mw.text.trim( rows[row] )
end
return ret
end
-- Charts - chart positions infobox row
p.chartinfoboxrow = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local country = string.gsub (parameters[1], "(BE)<sup>(%a*)</sup>", "%1%2")
local position = parameters[2]
if position then
position = mw.text.trim (position)
end
local entrydate = parameters[3]
if entrydate then
entrydate = mw.text.trim (entrydate)
end
local weeks = parameters[4]
if weeks then
weeks = mw.text.trim (weeks)
end
local ref = parameters[5]
local year = parameters.Jahr or string.match (entrydate, "(%d%d%d%d)$")
local countryconv = frame:expandTemplate{ title = 'ISO3166-A3-Conversion', args = { country } }
local countrycode = countrytable[countryconv] or countrytable[country]
local chartlink = nil
local numberone = nil
if countrycode then
chartlink = countrycode[2]
numberone = countrycode[6]
end
local numberonelink = nil
if numberone then
numberonelink = "Liste der Nummer-eins-Hits in " .. numberone
if year then
numberonelink = numberonelink .. " (" .. year .. ")"
end
end
local ret = "| style='width:5%; background-color:white;' | "
ret = ret .. "\n| style='width:10%; font-size:95%;' | "
if chartlink then
local countrydisplay = 0
if country == "BEF" then
countrydisplay = "BE<sup>F</sup>"
elseif country == "BEW" then
countrydisplay = "BE<sup>W</sup>"
elseif string.match (country, "^NL" ) then
countrydisplay = "NL"
elseif string.match (country, "^US" ) then
countrydisplay = "US"
elseif string.match (country, "^DE" ) then
countrydisplay = "DE"
else
countrydisplay = country
end
ret = ret .. "[[" .. chartlink .. "|" .. countrydisplay .. "]]"
else
ret = ret .. (country or "")
end
if countryconv == "BEL" and (tonumber(year) or 0) > 1994 then
ret = ret .. "<div style='display:none;'>[[Vorlage:Infobox Chart/Wartung/Belgien]]</div>"
end
ret = ret .. "\n| style='width:20%; font-size:95%; font-weight:bold; text-align:center;' | "
if position then
if string.match(position, "^%[%[Liste") then
ret = ret .. "<div style='display:none;'>[[Vorlage:Infobox Chart/Wartung/POS verlinkt]]</div>"
end
if position == "1" or string.match(position, "^1%D") then
if numberonelink then
position = "[[" .. numberonelink .. "|1]]" .. (string.match(position, "1(.*)") or "")
if not parameters.Jahr then
position = position .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/NR1-Link]]</div>"
end
end
end
ret = ret .. position
end
ret = ret .. "\n| style='width:30%; font-size:smaller;' | " .. (entrydate or "")
ret = ret .. "\n| style='width:25%; text-align:right; padding-left:5px; font-size:smaller;' | "
if weeks then
if weeks == "" or weeks == "…" or weeks == "..." then
weeks = "…<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/vorläufig"
if year then
if tonumber(year) > 2009 then
weeks = weeks .. "/" .. year
end
end
weeks = weeks .. "]]</div>"
if weeks == "..." then
weeks = weeks .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/Punkte]]</div>"
end
end
if string.match (weeks, "Mt") then
ret = ret .. "(" .. weeks .. ")"
else
ret = ret .. "(" .. weeks .. " Wo.)"
end
end
ret = ret .. "\n| style='width:10%; font-size:smaller;' | " .. (ref or "")
if string.match (parameters[1], "%a*<sup>%a*</sup>") then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/Sup]]</div>"
elseif string.match (country, "[^%a%s]") then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/Land falsch]]</div>"
elseif not countrycode then
if country ~= "DDR" then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/Land unbekannt]]</div>"
end
end
if #entrydate < 4 or string.match (entrydate, "[^%d%./]") then
ret = ret .. "<div style='display:none'>[[Vorlage:Infobox Chart/Wartung/Datum falsch]]</div>"
end
return ret
end
-- Wechsel zwischen Chart-Zeile und Chartbox-Zeile - switch between chart positions table row and infobox row
p.chartrows = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
if parameters.Q then
return p.chartposrow(frame)
else
return p.chartinfoboxrow(frame)
end
end
-- AfM-Tabelle - table for certifications
p.certificationtable = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local entry = {}
for k, v in ipairs (parameters) do
entry [k] = v
end
local rows = 0
repeat
rows = rows + 1
local entry = "" .. rows
until not parameters[entry]
rows = rows - 1
local ret = frame:preprocess( "<templatestyles src='Vorlage:Charttabelle/styles.css' />" )
local statistics = parameters.Statistik
local main = parameters.Hauptartikel
local note = parameters.Hinweis
local source = parameters.Q
local nosilver = parameters.S
local nodiamond = parameters.D
local pagename = mw.title.getCurrentTitle().text
if statistics and not note and not main and not string.match (pagename, "/Auszeichnungen für Musikverkäufe") then
local pagenameroot = string.match ( pagename, "(.+)/Diskografie" ) or pagename
local certifications = pagenameroot .. "/Auszeichnungen für Musikverkäufe"
if mw.title.new( certifications ).exists == false then
ret = ret .. "\n<span style='font-style:italic;font-size:smaller;'>Anmerkung: Auszeichnungen in Ländern aus den Charttabellen bzw. Chartboxen sind in ebendiesen zu finden.</span>"
end
end
ret = ret .. "\n{| class='wikitable"
if statistics then
ret = ret .. " sortable charts-zebragrey'"
else
ret = ret .. " charts-zebragrey2'"
end
ret = ret .. "\n|- \n! style='width:250px;background-color:#FFEBAD;'| Land/Region \n!"
if statistics then
if not nosilver then
ret = ret .. "style='background-color:#FFEBAD;' data-sort-type='number' | [[Datei:Silver record icon.svg|15px|verweis=]] Silber !! "
end
ret = ret .. "style='background-color:#FFEBAD;' data-sort-type='number' | [[Datei:Gold record icon.svg|15px|verweis=]] Gold !! "
ret = ret .. "style='background-color:#FFEBAD;' data-sort-type='number' | [[Datei:Platinum record icon.svg|15px|verweis=]] Platin"
if not nodiamond then
ret = ret .. " !! style='background-color:#FFEBAD;' data-sort-type='number' | [[Datei:Diamond record icon.svg|15px|verweis=]] Diamant"
end
else
ret = ret .. "style='width:150px;background-color:#FFEBAD;' | Auszeichnung" .. (source or "")
end
ret = ret .. "\n! style='width:90px;background-color:#FFEBAD;' data-sort-type='number' | Verkäufe"
if statistics then
ret = ret .. "\n ! class='unsortable' style='background-color:#FFEBAD;' | Quellen"
end
-- single rows
ret = ret .. "\n|-"
for row = 1, rows do
local content = entry[row]
if statistics then
if nosilver then
content = string.gsub (content, "\n| style='text%-align:center;' |<span style='display:none;'>0! S</span>—", "")
end
if nodiamond then
content = string.gsub (content, "\n| style='text%-align:center;' |<span style='display:none;'>0! D</span>—", "")
end
end
ret = ret .. "\n" .. content .. "\n|-"
end
local silver = parameters.GesS
local gold = parameters.GesG
local platinum = parameters.GesP
local diamond = parameters.GesD
local number = parameters.GesZ
ret = ret .. "\n|-"
if statistics then
ret = ret .. "style='background:#FBF8D6;' class='sortbottom' \n| <b>Insgesamt</b>"
if not nosilver then
ret = ret .. "\n| style='text-align:center;' | <b>" .. (silver or "—") .. "</b>"
end
ret = ret .. "\n| style='text-align:center;' | <b>" .. (gold or "—") .. "</b>"
ret = ret .. "\n| style='text-align:center;' | <b>" .. (platinum or "—") .. "</b>"
if not nodiamond then
ret = ret .. "\n| style='text-align:center;' | <b>" .. (diamond or "—") .. "</b>"
end
ret = ret .. "\n| colspan='2' |"
else
if number then
ret = ret .. "style='background:#FBF8D6;' \n| <i>Insgesamt</i> \n| style='text-align:center; font-style:italic;' |"
if silver or gold or platinum or diamond then
if silver then
ret = ret .. "[[Datei:Silver record icon.svg|15px|verweis=]] " .. silver .. "× Silber<br />"
end
if gold then
ret = ret .. "[[Datei:Gold record icon.svg|15px|verweis=]] " .. gold .. "× Gold<br />"
end
if platinum then
ret = ret .. "[[Datei:Platinum record icon.svg|15px|verweis=]] " .. platinum .. "× Platin<br />"
end
if diamond then
ret = ret .. "[[Datei:Diamond record icon.svg|15px|verweis=]] " .. diamond .. "× Diamant<br />"
end
else
ret = ret .. "—"
end
ret = ret .. "\n| style='text-align:right; font-style:italic;' | <b>" .. number .. "</b>"
end
end
ret = ret .. "\n|}"
if main then
ret = ret .. "\n<span style='font-style:italic; font-size:smaller;'>Hauptartikel: [[" .. main .. "]]</span>"
end
return ret
end
-- AfM - certification table rows
p.certificationtablerow = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local silver = parameters.S
local gold = parameters.G
local platinum = parameters.P
local diamond = parameters.D
local source = parameters.Q
local country = parameters[1]
local certification = parameters[2]
local number = parameters[3]
local sum = parameters[4]
local ret = "| "
local countrycode = nil
local countryconv = frame:expandTemplate{ title = 'ISO3166-A3-Conversion', args = { country } }
if countrytable[country] then
countrycode = country
else
countrycode = countryconv
end
if countrytable[countrycode] then
ret = ret .. "{{"
if countrycode == "EUR2" then
ret = ret .. "EUR"
else
ret = ret .. countrycode
end
ret = ret .. "|" .. countrytable[countrycode][4] .. "|" .. countrytable[countrycode][1] .. " (" .. countrytable[countrycode][5] .. ")}}"
else
ret = ret .. country
end
if silver or gold or platinum or diamond or tonumber(parameters[2]) then
local sum2 = parameters[2]
if silver ~= "n" then
ret = ret .. "\n| style='text-align:center;' |" .. (silver or "<span style='display:none;'>0! S</span>—")
end
ret = ret .. "\n| style='text-align:center;' |" .. (gold or "<span style='display:none;'>0! G</span>—")
ret = ret .. "\n| style='text-align:center;' |" .. (platinum or "<span style='display:none;'>0! P</span>—")
if diamond ~= "n" then
ret = ret .. "\n| style='text-align:center;' |" .. (diamond or "<span style='display:none;'>0! D</span>—")
end
ret = ret .. "\n| style='text-align:right;' |" .. (sum2 or "<span style='display:none;'>0!</span>—")
ret = ret .. "\n| " .. (source or "")
else
ret = ret .. (source or "") .. "\n| style='text-align:center;' | "
if certification == "" or certification == "-" or certification == "—" then
ret = ret .. "—"
elseif number == "" or number == "-" or number == "—" then
ret = ret .. certification or ""
elseif certification == "D+P" or certification == "P+D" then
ret = ret .. "[[Datei:Diamond record icon.svg|15px|verweis=]][[Datei:Decuple platinum record icon.svg|15px|verweis=]] " .. number .. "× Platin"
else
certification = certification .. (number or "")
local certicon = require ("Modul:Musikcharts/AfM-Icon")
local icontype = "text"
ret = ret .. certicon.certicon(frame, certification, icontype)
end
ret = ret .. "\n| style='text-align:right;' | " .. (sum or "")
end
return frame:preprocess (ret)
end
-- AfM - inline certification
p.certification = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local certification = parameters[1]
local number = parameters[2]
local sum = parameters[3]
local ret = ""
if certification == "D+P" or certification == "P+D" then
ret = ret .. "[[Datei:Diamond record icon.svg|15px|verweis=]][[Datei:Decuple platinum record icon.svg|15px|verweis=]] " .. number .. "× Platin"
else
certification = certification .. (number or "")
local certicon = require ("Modul:Musikcharts/AfM-Icon")
local icontype = "text"
ret = ret .. certicon.certicon(frame, certification, icontype)
end
if sum then
ret = ret .. " (" .. sum .."+)"
end
return frame:preprocess (ret)
end
-- Wechsel zwischen AfM/AfM2 - switch between certificationtablerow and certification
p.certifications = function (frame)
local parameters = frame.args
if not parameters[1] then parameters = mw.getCurrentFrame():getParent().args end
local ID = parameters[1]
local certnames = { ["S"] = true, ["Silber"] = true, ["G"] = true, ["Gold"] = true, ["P"] = true, ["Platin"] = true, ["D"] = true, ["Diamant"] = true, ["P+G"] = true, ["G+P"] = true, ["D+P"] = true, ["P+D"] = true}
if certnames[ID] then
return p.certification(frame)
else
return p.certificationtablerow(frame)
end
end
-- Nummer-eins-Hits - table for no. 1 hits and albums
p.no1table = function (frame)
local parameters = frame.args
if not parameters.Inhalt then parameters = mw.getCurrentFrame():getParent().args end
-- template parameters
local listtype = parameters.Art or "Hits"
local country = parameters.Land or "Land"
local name = parameters.Bezeichnung
if name == "" then
name = nil
end
local months = parameters.Monate
if months == "" then
months = nil
end
local content = parameters.Inhalt
-- country-based variables
for key,value in pairs(countrytable) do
if value[1] == country then
country = key
end
end
if country == "Großbritannien" then
country = "GBR"
elseif string.match (country, "...%-") then
country = string.match (country, "(...)%-")
end
local countryconv = frame:expandTemplate{ title = 'ISO3166-A3-Conversion', args = { country } }
local countryid = nil
local colourscheme = nil
if countrytable[countryconv] then
countryid = countrytable[countryconv][6] or countryconv
colourscheme = countrytable[countryconv][7] or "1"
else
countryid = parameters.Land
colourscheme = "1"
end
-- deprecated template parameters, now country-based
local colour1 = parameters.Farbe1 or colourtable[colourscheme][1]
local colour2 = parameters.Farbe2 or colourtable[colourscheme][2]
local rowcolour = parameters.FarbeZeilen or colourtable[colourscheme][3]
local flag = parameters.Flagge or "{{" .. countryconv .. "|#}}"
-- derived variables
local pagename = mw.title.getCurrentTitle().text
local currentyear = tonumber ( os.date( "%Y" ) )
local year = string.match (pagename, ".+%((%d%d%d%d)%)") or currentyear
local nav = "Navigationsleiste Nummer-eins-Hits in " .. countryid
local firstyear
if mw.title.new( nav, 'Vorlage' ).exists == true then
firstyear = frame:expandTemplate{ title = nav, args = { 'Beginn' } }
else
firstyear = "1950"
end
local prevyear = year - 1
local nextyear = year + 1
local linkprev
local linknext
if string.match (pagename, "%d%d%d%d") then
linkprev = string.gsub (pagename, "%d%d%d%d", prevyear)
linknext = string.gsub (pagename, "%d%d%d%d", nextyear)
else
linkprev = pagename .. " (" .. prevyear .. ")"
linknext = pagename .. " (" .. nextyear .. ")"
end
local listlink
if string.match (pagename, ".+%(%d%d%d%d%)") then
listlink = string.match (pagename, "(.+)%(%d%d%d%d%)")
else
listlink = pagename
end
if listtype == "Alben" and string.match (pagename, "Hits") then
local templistlink = "Liste der Nummer-eins-" .. listtype .. " in " .. countryid
if mw.title.new( templistlink ).exists then
listlink = templistlink
end
end
local sectionlink = "#"
if listtype == "Jahr" then
sectionlink = sectionlink .. "Jahreshitparaden"
else
sectionlink = sectionlink .. (listtype or "")
end
if name then
if string.match (name, "Wallon") then
sectionlink = sectionlink .. "_2"
end
end
-- build table
local ret = "{| cellspacing='0' width='100%' \n |- style='background-color:" .. colour1 .. "' \n| width='15%' |"
if prevyear >= tonumber(firstyear) then
ret = ret .. "[[" .. linkprev .. sectionlink .. "|← " .. prevyear .. "]]"
end
ret = ret .. "\n| colspan='3' style='text-align:center;' width='70%' |" .. (frame:preprocess(flag) or "") .. " [[" .. mw.text.trim (listlink) .."]]"
if name then
ret = ret .. " (" .. name .. ")"
end
ret = ret .. "\n| width='15%' style='text-align:right;' |"
if tonumber(year) < currentyear then
ret = ret .. "[[" .. linknext .. sectionlink .. "|" .. nextyear .. " →]]"
end
ret = ret .. "\n|- \n| colspan='5' |"
ret = ret .. "\n{| class='wikitable zebra sortable' style='width:100%; background-color:" .. rowcolour .."; border-spacing:none; border:none; margin:0;'"
ret = ret .. "\n! style='background-color:" .. colour2 .. "; border:none;"
if listtype == "Jahr" then
ret = ret .. "border-bottom: 1pt solid white;' class='unsortable' width='45%' | <span style='font-size:larger'>Singles</span>"
else
ret = ret .. "text-align:left;' width='15%' | Zeitraum !! data-sort-type='number' style='background-color:" .. colour2 .. "; border:none; text-align:center;' width='5%' | "
if months then
ret = ret .. "<abbr title='Monate insgesamt auf Platz eins'>Mt.<br /><span style='font-size:smaller'>ges.</span></abbr>"
else
ret = ret .. "<abbr title='Wochen insgesamt auf Platz eins'>Wo.<br /><span style='font-size:smaller'>ges.</span></abbr>"
end
end
ret = ret .. "\n! style='background-color:" .. colour2 .. "; border:none;"
if listtype == "Jahr" then
ret = ret .. "border-bottom: 1pt solid white;' width='10%' | Position"
else
ret = ret .. "text-align:left;' width='15%' | Interpret !! style='background-color:" .. colour2 .. "; border:none; text-align:left; font-style:italic;' width='25%' | Titel"
if listtype ~= "Alben" then
ret = ret .. "<span style='font-size:smaller; font-style:normal;'><br />Autor(en)</span>"
end
end
ret = ret .. "\n! style='background-color:" .. colour2 .. "; border:none;"
if listtype == "Jahr" then
ret = ret .. "border-bottom: 1pt solid white;' class='unsortable' width='45%' | <span style='font-size:larger'>Alben</span>"
else
ret = ret .. "text-align:left;' class='unsortable' width='40%' | Zusätzliche Informationen"
end
ret = ret .. "\n|- \n" .. (content or "") .. "\n|} \n|- style='background-color:" .. colour1 .. ";' \n|"
if prevyear >= tonumber(firstyear) then
ret = ret .. "[[" .. linkprev .. sectionlink .. "|← " .. prevyear .. "]]"
end
ret = ret .. "\n| colspan='3' | \n| style='text-align:right;' |"
if tonumber(year) < currentyear then
ret = ret .. "[[" .. linknext .. sectionlink .. "|" .. nextyear .. " →]]"
end
ret = ret .. "\n|}"
return ret
end
-- Nummer-eins-Hits Zeile - no. 1 table rows
p.no1tablerow = function (frame)
local parameters = frame.args
if not parameters.Chartein then parameters = mw.getCurrentFrame():getParent().args end
local lucky, DateTime = pcall( require, "Modul:DateTime" )
if type( DateTime ) == "table" then
DateTime = DateTime.DateTime()
else
-- Fehlerfall; DateTime enthält Fehlermeldung
return "<span class=\"error\">" .. DateTime .. "</span>"
end
local currentweek = mw.getContentLanguage():formatDate( 'W' )
-- template parameters
local chartentry = parameters.Chartein or tostring(currentweek - 1)
if chartentry == "" then
chartentry = nil
end
local chartexit = parameters.Chartaus or tostring(currentweek)
if chartexit == "" then
chartexit = nil
end
local yearturn = parameters.Jahr
if yearturn == "" then
yearturn = nil
end
local givenweeks = parameters.Wochen
if givenweeks == "" then
givenweeks = nil
end
local givenmonths = parameters.Monate
if givenmonths == "" then
givenmonths = nil
end
local total = parameters.Insges
if total == "" then
total = nil
end
local artist = parameters.Interpret
if artist == "" then
artist = nil
end
local title = parameters.Titel
if title == "" then
title = nil
end
local songwriters = parameters.Autor
if songwriters == "" then
songwriters = nil
end
local notes = parameters.Info
if notes == "" then
notes = nil
end
-- derived variables
local pagename = mw.title.getCurrentTitle().text
local year
if string.match (pagename, ".+%(%d%d%d%d%)") then
year = string.match (pagename, ".+%((%d%d%d%d)%)")
else
year = os.date( "%Y" )
end
local chartentryyear
if string.match (chartentry, "%d%d%d%d") then
chartentryyear = string.match (chartentry, "(%d%d%d%d)")
end
local chartexityear = string.match (chartexit, "(%d%d%d%d)")
if string.match (chartexit, "%d%d%d%d") then
chartexityear = string.match (chartexit, "(%d%d%d%d)")
end
-- date formats
local entrydateview
local entrydateweek
local entrydatemonth
local sortdate
if #chartentry > 2 then
local entrydate = DateTime (chartentry)
entrydateview = entrydate:format ("T._Monat JJJJ")
sortdate = entrydate:format ("ISO")
entrydateweek = entrydate:format ("W")
entrydatemonth = entrydate:format ("m")
else
entrydateview = chartentry .. "."
sortdate = chartentry
entrydateweek = chartentry
end
local exitdateview
local exitdateweek
local exitdatemonth
if #chartexit > 2 then
local exitdate = DateTime (chartexit)
exitdateview = exitdate:format ("T._Monat JJJJ")
local exitdate1 = exitdate + "1 day"
exitdateweek = exitdate1:format ("W")
exitdatemonth = exitdate:format ("m")
else
exitdateview = chartexit .. ". Woche"
exitdateweek = chartexit + 1
end
-- auto-calculate week and month number
local weeks = (exitdateweek - entrydateweek)
local months
if #chartentry > 2 and #chartexit > 2 then
months = (exitdatemonth - entrydatemonth) + 1
if months < 0 then
months = months + 12
end
end
local year1 = year
if yearturn == "-1" then
year1 = year - 1
end
if chartentryyear then
year1 = chartentryyear
if chartentryyear == chartexityear then
if tonumber(exitdatemonth) then
if tonumber(exitdatemonth) < 10 then
year1 = year1 - 1
end
end
end
end
local endweekdate = year1 .. "-12-28"
local endweek = DateTime (endweekdate)
local weeksyear = endweek:format ("W")
if weeks < 0 then
weeks = weeks + weeksyear
end
if weeks == 0 then
weeks = 1
end
-- build table row
local ret = "|- style='padding-top:5px; border:none; margin:none;' \n| style='border:none;'"
ret = ret .. " data-sort-value='" .. sortdate .. "'|" .. entrydateview
if #chartentry <= 2 and #chartexit <= 2 then
if tonumber(chartexit) < tonumber(chartentry) then
if yearturn == "-1" then
ret = ret .. " Woche " .. (year -1) .. " – " .. exitdateview .. " " .. (year)
else
ret = ret .. " Woche " .. year .. " – " .. exitdateview .. " " .. (year +1)
end
elseif chartentry == chartexit then
ret = ret .. " Woche"
else
ret = ret .. "–" .. exitdateview
end
elseif entrydateview ~= exitdateview then
if #chartentry <= 2 then
ret = ret .. " Woche"
end
ret = ret .. " – " .. exitdateview
end
ret = ret .. "<br /><span style='font-size:smaller'>"
local monthview
if (not string.match (entrydateview, "%.") and not givenweeks) or givenmonths then
monthview = true
end
if not monthview then
ret = ret .. (givenweeks or weeks or "…") .. " Woche"
if givenweeks then
if givenweeks ~= "1" then
ret = ret .. "n"
end
else
if weeks ~= 1 then
ret = ret .. "n"
end
end
else
ret = ret .. (givenmonths or months or "…") .. " Monat"
if givenmonths then
if givenmonths ~= "1" and givenmonths ~= "½" then
ret = ret .. "e"
end
else
if months ~= 1 and months ~= "½" then
ret = ret .. "e"
end
end
end
ret = ret .. "</span>" .. "\n| style='text-align:center; border:none;' |"
if monthview then
ret = ret .. (total or givenmonths or months)
else
ret = ret .. (total or givenweeks or weeks)
end
ret = ret .. "\n| style='border:none;' |" .. (artist or "Interpret")
ret = ret .. "\n| style='border:none; font-style:italic;' | " .. (title or "Titel")
if songwriters then
ret = ret .. "<br /><span style='font-style:normal;font-size:smaller;'>" .. songwriters .. "</span>"
end
ret = ret .. "\n| style='border:none;' | " .. (notes or "–")
-- Wartung
if givenweeks or givenmonths then
ret = ret .. "<div style='display:none'>[[Vorlage:Nummer-eins-Hits/Wartung/feste Dauer]]</div>"
elseif monthview then
ret = ret .. "<div style='display:none'>[[Vorlage:Nummer-eins-Hits/Wartung/Monate]]</div>"
end
return ret
end
return p