Module:Disambiguation/doc: Difference between revisions

From Thetacola Wiki
Jump to navigationJump to search
en>Paine Ellsworth
(High-use template)
 
m (1 revision imported)
 
(No difference)

Latest revision as of 00:26, 15 August 2022

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}}
  • {{#invoke:Disambiguation|isDisambiguationPage|New}}
  • {{#invoke:Disambiguation|isDisambiguationPage|Black swan (disambiguation)}} → yes

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

  • {{#invoke:Disambiguation|isDisambiguationPage|{{SUBJECTPAGENAME}}}}

Usage within Lua modules[edit source]

Import this module, e.g with

local mDisambiguation = require('Module:Disambiguation')

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:

local isDab = mDisambiguation.isDisambiguation(content) -- returns true or false
(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:

local isDab = mDisambiguation._isDisambiguationPage(pageName) -- returns true or false
(where pageName is a string, the name of page to check)