Jump to content

Module:Disambiguation/doc

From Humanipedia

This is the documentation page for Module:Disambiguation

Script error: No such module "High-use". Lua error in package.lua at line 80: module 'Module:Yesno' not found. This module detects if a given page is a disambiguation page.

Usage[edit source]

{{#invoke:Disambiguation|isDisambiguationPage|Page title}}
returns yes if the page is a disambiguation page, or nothing if the page is not a disambiguation page

Examples:

  • {{#invoke:Disambiguation|isDisambiguationPage|Paris}}Script error: No such module "Disambiguation".
  • {{#invoke:Disambiguation|isDisambiguationPage|New}}Script error: No such module "Disambiguation".
  • {{#invoke:Disambiguation|isDisambiguationPage|Black swan (disambiguation)}}Script error: No such module "Disambiguation".

You can also use magic words like {{SUBJECTPAGENAME}}:

  • {{#invoke:Disambiguation|isDisambiguationPage|{{SUBJECTPAGENAME}}}}Script error: No such module "Disambiguation".

Usage within Lua modules[edit source]

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

If you have already have a Title object for the page to check, get the content using the title object's getContent() method, and pass that into isDisambiguation: <syntaxhighlight lang="lua"> local isDab = mDisambiguation.isDisambiguation(content) -- returns true or false </syntaxhighlight>

(where content 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 _isDisambiguationPage: <syntaxhighlight lang="lua"> local isDab = mDisambiguation._isDisambiguationPage(pageName) -- returns true or false </syntaxhighlight>

(where pageName is a string, the name of page to check)

Internal operations[edit source]

  • Although set index articles are treated by some templates as disambiguation pages, they are actually considered a special type of list and are not treated as disambiguation pages by this module
  • As this module relies on detecting templates with names like "disambiguation" in the article text, it is subject to false positives by templates such as {{italic disambiguation}}. These templates should be added to the falsePositives list in the code to exclude them.
  • The list of disambiguation templates is maintained at Module:Disambiguation/templates.