Jump to content

Module:Is article

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 16:46, 2 July 2020. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.main(frame)
	local getArgs = require('Module:Arguments').getArgs
	local args = getArgs(frame)
	title = args[1]
	page = mw.title.new(title, 0)

	if (not page.exists) then
		return "empty"
	end

	if (page.isRedirect) then
		return "redirect"
	end

	local content = page:getContent()
	if content 
	and content:match('{{%s*[Dd]isambig%a*%s*}}')
	or content:match('{{%s*[Dd]ab%s*}}')
	or content:match('{{%s*[Ss]urname%s*}}')
	then
		return "dab"
	end

	return "article"
end

return p