« Module:Anncréa » : différence entre les versions

Une page de Wikiversité, la communauté pédagogique libre.
Contenu supprimé Contenu ajouté
mise à jour
mise à jour
Ligne 33 : Ligne 33 :
elseif 73104 < pageid and pageid < 75513 then
elseif 73104 < pageid and pageid < 75513 then
reponse = 2019
reponse = 2019
elseif 75512 < pageid and pageid < 77055 then
else
reponse = 2020
reponse = 2020
else
reponse = 2021
end
end
else
else

Version du 1 janvier 2021 à 04:56

Ce module permet de donner l'année de création d'une page de la Wikiversité.

Pour obtenir l'année de création d'une page, il suffit d'inclure dans celle-ci, la commande {{#invoke:Anncréa|date|{{PAGEID}}}}.

On obtient, par exemple, pour la présente page : 2014


local p = {}

function p.date(frame)
	local reponse = ""
	local pageid = tonumber(frame.args[1])
	if pageid then
		if pageid < 1100 then
			reponse = 2006
		elseif 1099  < pageid and pageid < 14970 then
			reponse = 2007
		elseif 14969  < pageid and pageid < 20940 then
			reponse = 2008
		elseif 20939  < pageid and pageid < 25480 then
			reponse = 2009
		elseif 25479  < pageid and pageid < 30490 then
			reponse = 2010
		elseif 30489  < pageid and pageid < 35270 then
			reponse = 2011
		elseif 35269  < pageid and pageid < 43750 then
			reponse = 2012
		elseif 43749  < pageid and pageid < 48519 then
			reponse = 2013
		elseif 48518  < pageid and pageid < 52236 then
			reponse = 2014
		elseif 52235  < pageid and pageid < 58766 then
			reponse = 2015
		elseif 58765  < pageid and pageid < 63709 then
			reponse = 2016
		elseif 63708  < pageid and pageid < 68665 then
			reponse = 2017
        elseif 68664  < pageid and pageid < 73105 then
			reponse = 2018
		elseif 73104  < pageid and pageid < 75513 then
			reponse = 2019
		elseif 75512  < pageid and pageid < 77055 then
			reponse = 2020
		else
			reponse = 2021
		end
	else
		reponse = 0
	end
	return reponse
end

return p