Documentation for this module may be created at Module:Sandbox/SD0001/Title/doc

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

local p = {}

function p.santizeTitle(frame)
	local parsed = frame:preprocess( content )
	return mw.ustring.find(parsed, "__DISAMBIG__", 1, true)
end

p.isDisambiguation = function(content, frame)
	-- false if there is no content
	if content == nil then return false end
	
	local parsed = frame:preprocess( content )
	local match = mw.ustring.find(parsed, "__DISAMBIG__", 1, true)
	if match == nil then return false else return true end 
end

p._isDisambiguationPage = function(page, frame)
	-- Look for disamiguation template in page content
	local title = mw.title.new(page)
	if not title then return false end
	local content = title:getContent()
	return p.isDisambiguation(content, frame)
end

-- Entry points for templates
p.isDisambiguationPage = function(frame)
	local title = frame.args[1]
	return p._isDisambiguationPage(title, frame) and "yes" or ""
end


return p