Module:NextText

From Marxists-en
Jump to navigation Jump to search

Documentation for this module may be created at 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