Module:ExistNotRedirect

From blackwiki
Revision as of 17:59, 10 July 2019 by blackwiki>MusikBot II (Protected "Module:ExistNotRedirect": High-risk template or module (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)))
Jump to navigation Jump to search

Implements {{ExistNotRedirect}}


local p = {}


function p.main(args)
	local myArgs = mw.getCurrentFrame():getParent().args
	local myPageName = myArgs[1]
	if (myPageName == nil) or (myPageName == "") then
		return ""
	end

	local mypageTitle = mw.title.makeTitle("", myPageName)
	if mypageTitle.exists then
		if mypageTitle.isRedirect then
			return ""
		else
			return myPageName
		end
	end

	return ""

end

return p