Jump to content

Module:Redirect/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 65.141.6.170 (talk) at 08:19, 6 June 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


This module contains functions to find the target of a redirect page.

Main

  • <t lang="lua">

local mRedirect = require('Module:Redirect') </syntaxhighlight>

Then use the function with the following synt < lang="lua"> mRedirect.luaMain(rname, bracket) </syntaxhighlight>

rname is the name of the redirect page, and if bracket is anything but false or nil, the module will produce a link rather than just a page name.

IsRedirect

The isRedirect function is used from wiki pages to find out if a given page is a redirect or not. If the page is a redirect, the function returns "yes", and if not the output is blank. Its usage is {{#invoke:redirect|isRedirect|page-name}}.

Examples

  • <l mRedirect = require('Module:Redirect')

mRedirect.luaIsRedirect(rname) </syntaxhighlight>

GetTarget

The getTarget function fetches the target page name of a redirect page, and is only usable from Lua. If the page specified is a redirect, then the target is returned; otherwise the function returns nil.

To use it, first load the module.

<syntaxhighlight lang="lua"> local mRedirect = require('Module:Redirect') uses this module