Changes

Pywikibot 6.4.0
{{Module rating|alpha}}
This module detects if a given page is a disambiguation page.

==Usage==
<pre>
{{#invoke:Disambiguation|isDisambiguationPage|Page title}}
</pre>
:returns <code>yes</code> if the page is a disambiguation page, or nothing if the page is not a disambiguation page

Examples:
* <code><nowiki>{{#invoke:Disambiguation|isDisambiguationPage|</nowiki>[[Paris]]}}</code> → {{#invoke:Disambiguation|isDisambiguationPage|Paris}}
* <code><nowiki>{{#invoke:Disambiguation|isDisambiguationPage|</nowiki>[[New]]}}</code> → {{#invoke:Disambiguation|isDisambiguationPage|New}}
* <code><nowiki>{{#invoke:Disambiguation|isDisambiguationPage|</nowiki>[[Black swan (disambiguation)]]}}</code> → {{#invoke:Disambiguation|isDisambiguationPage|Black swan (disambiguation)}}
You can also use magic words like {{tl|SUBJECTPAGENAME}}:
* <code><nowiki>{{#invoke:Disambiguation|isDisambiguationPage|{{SUBJECTPAGENAME}}</nowiki>}}</code> → {{#invoke:Disambiguation|isDisambiguationPage|{{SUBJECTPAGENAME}}}}

===Usage within Lua modules===
Import this module, e.g with
<syntaxhighlight lang="lua">
local mDisambiguation = require('Module:Disambiguation')
</syntaxhighlight>
Then you can use the functions <code>isDisambiguation</code> and <code>_isDisambiguationPage</code>.

If you have already have a [[mw:Lua_reference_manual#Title_objects|Title object]] for the page to check, get the content using the title object's getContent() method, and pass that into <code>isDisambiguation</code>:
<syntaxhighlight lang="lua">
local isDab = mDisambiguation.isDisambiguation(content) -- returns true or false
</syntaxhighlight>
:(where <code>content</code> is a string, the wikitext content of page to check)

If you don't otherwise need the title, you can pass in the page name to <code>_isDisambiguationPage</code>:
<syntaxhighlight lang="lua">
local isDab = mDisambiguation._isDisambiguationPage(pageName) -- returns true or false
</syntaxhighlight>
:(where <code>pageName</code> is a string, the name of page to check)
<includeonly>
[[Category:Disambiguation and redirection templates]]
</includeonly>