Module:Is article
Appearance
![]() | This module depends on the following other modules: |
Module:Is article is used to determine if a given page is an article, a redirect, a disambiguation page, does not exist or a bad title.
Usage
{{#invoke:Is article|main|page_name}}
Return values
Result | Return value |
---|---|
Article | article |
Redirect | redirect |
Disambiguation page | dab |
Page does not exist | empty |
bad title | badtitle |
Parameter list
Parameter | Explanation |
---|---|
1
|
Positional or numbered parameter; The page name title. |
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*}}') then
return "dab"
end
return "article"
end
return p