Mòdul:POTD: diferència entre les revisions

Contingut suprimit Contingut afegit
salt d'any per galeries a partir de l'1 de gener
amplio a dos anys anteriors si no n'hi ha cap en l'actual
Línia 6:
local pictures_curr = mw.loadData("Module:POTD/" .. current_year)
local pictures_prev = mw.loadData("Module:POTD/" .. current_year - 1)
local pictures_ant = mw.loadData("Module:POTD/" .. current_year - 2)
local pictures_next = mw.loadData("Module:POTD/" .. current_year + 1)
 
Linha 31 ⟶ 32:
elseif pictures_curr.file[daymonth] ~= nil then
buildgallery = buildgallery .. '\n' .. 'File:' .. pictures_curr.file[daymonth] .. '|' .. daymonth .. ': ' .. (pictures_curr.footer[daymonth] or '')
elseif pictures_prev.file[daymonth] ~= nil then
buildgallery = buildgallery .. '\n' .. 'File:' .. pictures_prev.file[daymonth] .. '|' .. daymonth .. ': ' .. (pictures_prev.footer[daymonth] or '')
else
buildgallery = buildgallery .. '\n' .. 'File:Empty set.svg' .. '|' .. daymonth
Linha 39 ⟶ 42:
elseif pictures_prev.file[daymonth] ~= nil then
buildgallery = buildgallery .. '\n' .. 'File:' .. pictures_prev.file[daymonth] .. '|' .. daymonth .. ': ' .. (pictures_prev.footer[daymonth] or '')
elseif pictures_ant.file[daymonth] ~= nil then
buildgallery = buildgallery .. '\n' .. 'File:' .. pictures_ant.file[daymonth] .. '|' .. daymonth .. ': ' .. (pictures_ant.footer[daymonth] or '')
else
buildgallery = buildgallery .. '\n' .. 'File:Empty set.svg' .. '|' .. daymonth
Linha 60 ⟶ 65:
daymonth = option
end
while not pictures_curr.file[daymonth] and not pictures_prev.file[daymonth] and not pictures_ant.file[daymonth] do
absolutetime = absolutetime - 86400 -- previous day
daymonth = os.date("%d/%m", absolutetime)
Linha 70 ⟶ 75:
filename = pictures_prev.file[daymonth]
description = pictures_prev.footer[daymonth]
if filename == nil then
filename = pictures_ant.file[daymonth]
description = pictures_ant.footer[daymonth]
end
end