require('strict')

local getArgs = require('Module:Arguments').getArgs
local conv = require('Module:Number conv')
local toArabic = require('Module:Roman').toArabic
local p = {}

-- Template:Recto-verso

function p._recto_verso(args)
	local n = tonumber(args[1]) or conv.eastern2number(args[1]) or conv.jomml2number(args[1]) or toArabic(args[1]) or 0
	if n % 2 == 1 then
		return args[2]
	else
		return args[3]
	end
end

function p.recto_verso(frame)
	return p._recto_verso(getArgs(frame))
end

return p