Module:Redirect/sandbox/doc

The 'main' function of this module accepts the name of a single page. It determines if the page is a redirect; if so it looks up the page, extracts the target,

Module:Redirect/sandbox/doc

Main function

The 'main' function of this module accepts the name of a single page. It determines if the page is a redirect; if so it looks up the page, extracts the target, and returns the target name as text. Its usage is {{#invoke:redirect|main|redirect-page-name}}.

The template normally neither takes nor gives square brackets, so to show the result asyty

a link use [[{{#invoke:redirect|main|redirect-page-name}}]].  An error is produced if the redirect does not exist, but for versatility no error is given if the file is not a redirect (returns the original text) or if the file name is blank (returns blank).

However, if the parameter bracket is given a nonblank value, brackets will be passed on if present.

Examples

See Module:Redirect/testcases

{{#invoke:redirect|main|WP:AFC}}

produces

Wikipedia:Articles for creation

{{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}}

produces

Wikipedia:Articles for deletion

If the target isnt a redirect:

{{#invoke:redirect|main|Wikipedia:Articles for deletion|}}

produces

Wikipedia:Articles for deletion

Block function

The 'block' function replaces redirects with the actual names of articles in text entered either directly (using the text= parameter) or by specifying the name of an index page in the first unlabelled parameter. Because checking for redirects is WP:expensive, it only checks a limited number of links, so a feature is given to start only after reaching a link with a particular name. There is also a feature to limit replacements to piped links ([[A|B]] or unpiped links, or to make a piped link when an unpiped link is changed. This allows it to be used to make limited substitutions in articles without disrupting the text.

parameters

  • 1 = provides the name of the page containing the multiple redirects to process. Ignored if text is specified.
  • text = (or unnamed first parameter) provides a text on which to do substitutions
  • 2 = (or unnamed second parameter) specifies the name of a wikilink (given in its original form, perhaps a redirect) at which to begin substitutions.
  • pipe =
  • If omitted, all links are processed: [[A]] -> [[X]], [[A|B]] -> [[X|B]]
  • If no, unpiped links are processed: [[A]] -> [[X]], [[A|B]] -> [[A|B]]
  • If yes, piped links are processed: [[A]] -> [[A]], [[A|B]] -> [[X|B]]
  • If make, all links are processed, pipes are added on rename if absent: [[A]] -> [[A|X]], [[A|B]] -> [[X|B]]. Note that make is the setting most practical for article text to be subsequently screened for duplicate wikilinks.
  • nowiki = (set to 'no' if some processing of the output is desired; usually you don't want this)

examples

See Module talk:Redirect/sandbox/testcases

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.