Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Redirect/sandbox/doc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{used in system}} {{Module rating|beta}} == 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 <nowiki>{{#invoke:redirect|main|redirect-page-name}}</nowiki>. The template normally neither takes nor gives square brackets, so to show the result as a link use <nowiki>[[{{#invoke:redirect|main|redirect-page-name}}]]</nowiki>. 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]]'' <nowiki>{{#invoke:redirect|main|WP:AFC}}</nowiki> produces {{#invoke:redirect|main|WP:AFC}} <nowiki>{{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}}</nowiki> produces {{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}} If the target isnt a redirect: <nowiki>{{#invoke:redirect|main|Wikipedia:Articles for deletion|}}</nowiki> produces {{#invoke:redirect|main|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 (<nowiki>[[A|B]]</nowiki> 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: <nowiki>[[A]] -> [[X]], [[A|B]] -> [[X|B]]</nowiki> :* If ''no'', unpiped links are processed: <nowiki>[[A]] -> [[X]], [[A|B]] -> [[A|B]]</nowiki> :* If ''yes'', piped links are processed: <nowiki>[[A]] -> [[A]], [[A|B]] -> [[X|B]]</nowiki> :* If ''make'', all links are processed, pipes are added on rename if absent: <nowiki>[[A]] -> [[A|X]], [[A|B]] -> [[X|B]]</nowiki>. 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]]
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Articles for deletion
(
edit
)
WP:AFC
(
edit
)
WP:AFD
(
edit
)
Template:Module rating
(
edit
)
Template:Sandbox other
(
edit
)
Template:Used in system
(
edit
)
Module:Arguments
(
edit
)
Module:High-use
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Redirect
(
edit
)
Module:String
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/R
(
edit
)
Module:Yesno
(
edit
)