Module:NextText

De Marxists-fr
RĂ©vision datĂ©e du 27 octobre 2019 Ă  00:36 par Wikirouge (discussion | contributions) (Page crĂ©Ă©e avec « local p = {} --local p = {} -- p est l’abrĂ©gĂ© de paquet function p.Next( frame ) local title = frame.args[1] if string.match(title, ".+%([0-9]+%)") ~= nil then lo... »)
(diff) ← Version prĂ©cĂ©dente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller Ă  la navigation Aller Ă  la recherche

La documentation pour ce module peut ĂȘtre crĂ©Ă©e Ă  Module:NextText/doc

local p = {} --local p = {} -- p est l’abrĂ©gĂ© de paquet

function p.Next( frame )
	local title = frame.args[1]
	if string.match(title, ".+%([0-9]+%)") ~= nil then
		local _, _, a, b = string.find(title, "(.+%()([0-9]+)")
		b = tostring(tonumber(b)+1)
    	return a..b..")"
    end
end

function p.Previous( frame )
	local title = frame.args[1]
	if string.match(title, ".+%([0-9]+%)") ~= nil then
		local _, _, a, b = string.find(title, "(.+%()([0-9]+)")
		if tonumber(b) >= 1 then
			b = tostring(tonumber(b)-1)
			return a..b..")"
		end
    end
end

return p