Implements


require('strict')

local p = {}

local getArgs = require('Module:Arguments').getArgs

function p._namespace_other(args)
	local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText)
	if namespace == '' then
		namespace = 'main'
	end
	local target = string.lower(args.target or 'main')
	
	local special_targets = {
		['page index'] = {page = true, index = true}
	}
	
	if namespace == target or (special_targets[target] and special_targets[target][namespace]) then
		return args[1]
	else
		return args[2]
	end
end

function p.namespace_other(frame)
	return p._namespace_other(getArgs(frame))
end

return p