Difference between revisions of "Module:Redirect/doc"

From blackwiki
Jump to navigation Jump to search
test>Wnt
(Not bad template!)
test>Christian75
(The category was removed in last edit, but not the template {{Module rating|alpha}})
Line 1: Line 1:
{{Module rating|alpha}}
 
 
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 <nowiki>{{#invoke:redirect|main|redirect-page-name}}</nowiki>.
 
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 <nowiki>{{#invoke:redirect|main|redirect-page-name}}</nowiki>.
  
Line 23: Line 22:
 
{{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}}
 
{{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}}
  
If the target isnt a redirect:,
+
If the target isnt a redirect:
  
 
<nowiki>{{#invoke:redirect|main|Wikipedia:Articles for deletion|}}</nowiki>
 
<nowiki>{{#invoke:redirect|main|Wikipedia:Articles for deletion|}}</nowiki>

Revision as of 22:32, 17 April 2013

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 as 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

WP:AFC


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

produces

WP:AFD

If the target isnt a redirect:

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

produces

wikipedia:Articles for deletion