词条 | Module:Redirect/sandbox/doc |
释义 |
Main functionThe '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 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. ExamplesSee Redirect/testcases{{#invoke:redirect|main|WP:AFC}} produces {{#invoke:redirect|main|WP:AFC}}{{#invoke:redirect|main|[[WP:AFD]]|bracket=yes}} produces {{#invoke:redirect|main|AFD|bracket=yes}}If the target isnt a redirect: {{#invoke:redirect|main|Wikipedia:Articles for deletion|}} produces {{#invoke:redirect|main|Wikipedia:Articles for deletion|}}Block functionThe '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 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
examplesSee Redirect/sandbox/testcases |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。