Difference between revisions of "Template:Honor prerequisite"
Line 1: | Line 1: | ||
{{#vardefine:link|[[AY Honors/{{{honor}}}|{{{displayname|{{{honor}}}}}}]]}}{{#vardefine:third_element|{{#titleparts:{{PAGENAME}}|1|3}}}}{{#vardefine:first_element|{{#titleparts:{{PAGENAME}}|1|1}}}}{{#if:{{{linkonly|}}}|{{#var:link}}|{{Localize|For tips and instruction see}}{{#var:link}}.}} | {{#vardefine:link|[[AY Honors/{{{honor}}}|{{{displayname|{{{honor}}}}}}]]}}{{#vardefine:third_element|{{#titleparts:{{PAGENAME}}|1|3}}}}{{#vardefine:first_element|{{#titleparts:{{PAGENAME}}|1|1}}}}{{#if:{{{linkonly|}}}|{{#var:link}}|{{Localize|For tips and instruction see}}{{#var:link}}.}} | ||
<includeonly>{{#ifeq:Answer Key|{{#var:third_element}} | <includeonly>{{#ifeq:Answer Key|{{#var:third_element}} | ||
− | |<!--included by an answer key-->[[Category:AY Honors/Prerequisite Answer/{{{honor}}}]] | + | |<!--included by an answer key-->[[Category:AY Honors/Prerequisite Answer/{{{honor}}}{{GetLangSuffix}}]] |
− | |{{#ifeq:Investiture Achievement|{{#var:first_element}}|[[Category:AY Honors/Prerequisite IA/{{{honor}}}]]|[[Category:AY Honors/Prerequisite/{{{honor}}}]]}}}}</includeonly> | + | |{{#ifeq:Investiture Achievement|{{#var:first_element}}|[[Category:AY Honors/Prerequisite IA/{{{honor}}}{{GetLangSuffix}}]]|[[Category:AY Honors/Prerequisite/{{{honor}}}{{GetLangSuffix}}]]}}}}</includeonly> |
+ | <noinclude> | ||
+ | This template will link to an honor that is a prerequisite. It will also add itself to it's prerequisite's category. If the template is invoked from an Answer Key page (which it determines by comparing the third element of the invoking page's title to "Answer Key"), it adds it the category "AY Honor/Prerequisite Answer/<nowiki>{{{</nowiki>honor}}}". Else it looks to see if the first element of the page title is "Investiture Achievement", and if it is, it adds itself to the category "AY Honor/Prerequisite IA/<nowiki>{{{</nowiki>honor}}}". If neither of these is true, it is most likely that the invoking page is an honor's landing page (which includes the Answer Key page, and thus inherits the honor_prerequisite template), so it adds the page to the category "AY Honor/Prerequisite/<nowiki>{{{</nowiki>honor}}}". | ||
+ | |||
+ | Not that in all three cases, it uses the GetLangSuffix template to add it to the language's category. | ||
+ | </noinclude> |
Revision as of 03:20, 31 January 2021
For tips and instruction see[[AY Honors/{{{honor}}}|{{{honor}}}]].
This template will link to an honor that is a prerequisite. It will also add itself to it's prerequisite's category. If the template is invoked from an Answer Key page (which it determines by comparing the third element of the invoking page's title to "Answer Key"), it adds it the category "AY Honor/Prerequisite Answer/{{{honor}}}". Else it looks to see if the first element of the page title is "Investiture Achievement", and if it is, it adds itself to the category "AY Honor/Prerequisite IA/{{{honor}}}". If neither of these is true, it is most likely that the invoking page is an honor's landing page (which includes the Answer Key page, and thus inherits the honor_prerequisite template), so it adds the page to the category "AY Honor/Prerequisite/{{{honor}}}".
Not that in all three cases, it uses the GetLangSuffix template to add it to the language's category.