La documentation pour ce module peut être créée à Module:Oricon/doc
local p = {}
function p.OriconWeek(frame)
local args = frame:getParent().args
output = ""
Weeks = args['weeks'] or 1
Weeks = tonumber(Weeks)
local WeekData = args[1]
_, _, d1, d2, d3, d4, d5, d6, d7, w1 = string.find(WeekData, "(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.*)")
output = output .. "|-\n"
output = output .. "| " .. ProcessDay(d1) .. "\n"
output = output .. "| " .. ProcessDay(d2) .. "\n"
output = output .. "| " .. ProcessDay(d3) .. "\n"
output = output .. "| " .. ProcessDay(d4) .. "\n"
output = output .. "| " .. ProcessDay(d5) .. "\n"
output = output .. "| " .. ProcessDay(d6) .. "\n"
output = output .. "| " .. ProcessDay(d7) .. "\n"
output = output .. "| " .. ProcessWeek(w1) .. "\n"
CurrentWeek=1
while CurrentWeek < Weeks do
output = output .. "|-\n| -\n| -\n| -\n| -\n| -\n| -\n| -\n"
CurrentWeek=CurrentWeek+1
end
return output
end
function p.OriconWeekOnly(frame)
local args = frame:getParent().args
output = ""
Weeks = args['weeks'] or 1
Weeks = tonumber(Weeks)
local w1 = args[1]
output = output .. "|-\n| -\n| -\n| -\n| -\n| -\n| -\n| -\n| " .. ProcessWeek(w1) .. "\n"
CurrentWeek=1
while CurrentWeek < Weeks do
output = output .. "|-\n| -\n| -\n| -\n| -\n| -\n| -\n| -\n"
CurrentWeek=CurrentWeek+1
end
return output
end
function ProcessDay (Day)
_, count = string.gsub(Day, "/", "/")
if count==0 then
if Day=="1" then Day="'''1'''" end
return Day
else
_, _, rank, sales = string.find(Day, "(.*)/(.*)")
newsales=tonumber(sales)
if newsales then --If it got a proper number, do the number stuff.
sales = comma_value(sales)
end --If that didn't happen, sales will still be the string or whatever was given
--sales = sales + 0 --turn into number for further formatting
--sales = comma_value(sales)
if rank=="1" then rank="'''1'''" end
return rank .. "<br /><small>" .. sales .. "</small>"
end
end
function ProcessWeek (Week)
MultiRows = ""
if Weeks > 1 then
MultiRows = "rowspan=" .. Weeks .. " |"
end
_, count = string.gsub(Week, "/", "/")
if count==0 then
if Week=="1" then Week="'''1'''" end
return MultiRows .. Week .. " \n| " .. MultiRows
else
_, _, rank, sales = string.find(Week, "(.*)/(.*)")
newsales=tonumber(sales)
if newsales then --If it got a proper number, do the number stuff.
sales = comma_value(sales)
end --If that didn't happen, sales will still be the string or whatever was given
--sales = sales + 0 --turn into number for further formatting
--sales = comma_value(sales)
if rank=="1" then rank="'''1'''" end
return MultiRows .. rank .. "\n| " .. MultiRows .. sales
end
end
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
return p