Difference between revisions of "Template:IsVariant"
From Pathfinder Wiki
(Created page with "<includeonly> {{#vardefine:page|{{#titleparts:{{{page|{{PAGENAME}}}}}|2}}}} {{#var:page}} {{#titleparts:{{{page|{{PAGENAME}}}}}|2}} <includeonly> <noinclude> {{IsVariant|page=...") |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | <includeonly> | + | <includeonly>{{#vardefine:page|{{#titleparts:{{{page|{{PAGENAME}}}}}|2}}}}{{#vardefine:base|{{#explode:{{#var:page}}|(|0}}}}{{#vardefine:variant|{{#replace:{{#explode:{{#var:page}}|(|1}}|)}}}} |
| − | {{#vardefine:page|{{#titleparts:{{{page|{{PAGENAME}}}}}|2}}}} | + | {{#if:{{#var:variant}}|{{#ifexist:{{#var:base}}|{{#if:{{{text|}}}|{{{text}}} [[{{#var:base}}{{GetLangSuffix|page={{{page|{{PAGENAME}}}}}}}]]|{{#var:base}}{{GetLangSuffix|page={{{page|{{PAGENAME}}}}}}}}}}}}} |
| − | {{#var:page}} | + | </includeonly> |
| − | {{# | ||
| − | <includeonly> | ||
<noinclude> | <noinclude> | ||
| − | {{IsVariant|page=AY Honors/Archery (General Conference)}} | + | This template evaluates the '''page''' argument (or the title of the invoking page if '''page''' is not supplied) to determine if it is a variant of another honor. |
| + | |||
| + | If it determines that '''page''' is a variant, it will return the page title of the base honor. Otherwise it will return an empty string. | ||
| + | |||
| + | {|border=1 | ||
| + | !page parameter | ||
| + | !Return string | ||
| + | !Note | ||
| + | |- | ||
| + | |AY Honors/Archery (General Conference) | ||
| + | |{{IsVariant|page=AY Honors/Archery (General Conference)}} | ||
| + | |Is a variant, so returns the base | ||
| + | |- | ||
| + | |AY Honors/Archery (General Conference) | ||
| + | |{{IsVariant|page=AY Honors/Archery (General Conference)|text=This: }} | ||
| + | |Same as above, but also supplied with a "text=This:" parameter | ||
| + | |- | ||
| + | |AY Honors/Archery (General Conference)/es | ||
| + | |{{IsVariant|page=AY Honors/Archery (General Conference)/es}} | ||
| + | |Works in Spanish! | ||
| + | |- | ||
| + | |AY Honors/Archery | ||
| + | |{{IsVariant|page=AY Honors/Archery}} | ||
| + | |Is the base, so returns nothing | ||
| + | |- | ||
| + | |AY Honors/Child Care (Babysitting) | ||
| + | |{{IsVariant|page=AY Honors/Child Care (Babysitting)}} | ||
| + | |Is not a variant because [[AY Honors/Child Care]] does not exist. | ||
| + | |- | ||
| + | |AY Honors/Christian Citizenship (United States) | ||
| + | |{{IsVariant|page=AY Honors/Christian Citizenship (United States)}} | ||
| + | |Is a variant because [[AY Honors/Christian Citizenship]] ''does'' exist. | ||
| + | |} | ||
| + | </noinclude> | ||
Latest revision as of 23:32, 2 March 2021
This template evaluates the page argument (or the title of the invoking page if page is not supplied) to determine if it is a variant of another honor.
If it determines that page is a variant, it will return the page title of the base honor. Otherwise it will return an empty string.
| page parameter | Return string | Note |
|---|---|---|
| AY Honors/Archery (General Conference) |
AY Honors/Archery
|
Is a variant, so returns the base |
| AY Honors/Archery (General Conference) |
This: AY Honor Archery
|
Same as above, but also supplied with a "text=This:" parameter |
| AY Honors/Archery (General Conference)/es |
AY Honors/Archery/es
|
Works in Spanish! |
| AY Honors/Archery |
|
Is the base, so returns nothing |
| AY Honors/Child Care (Babysitting) |
AY Honors/Child Care
|
Is not a variant because AY Honor Child Care does not exist. |
| AY Honors/Christian Citizenship (United States) |
AY Honors/Christian Citizenship
|
Is a variant because AY Honor Christian Citizenship does exist. |
