-- helper module; not intended for general use
function transclude( args )
	local index = args.index
	local startp = tonumber( args.startp )
	local endp = tonumber( args.endp )
	local starts = args.starts
	local ends = args.ends
	local num = tonumber( args.num )

	-- Without index and start and end page number there's nothing to do.
	if startp == nil or endp == nil or index == "" then
		return
	end
	
	local content = ''
	for i = startp, endp do
		content = content .. '{{page|' .. index .. '/' .. i .. '|'
		if i == startp and starts ~= nil and starts ~= '' then
			content = content .. 'section=' .. starts ..'|'
		elseif i == endp and ends ~= nil and ends ~= '' then
			content = content .. 'section=' .. ends ..'|'
		end
		content = content .. 'num=' .. num .. '}}\n'
		num = num + 1
	end
	return content
end

return {
	transclude = function( frame ) return transclude( frame.args ) end;
}