Difference between revisions of "Template:GetMasterCategoryList"
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
+ | This template outputs a <nowiki><br/>-separated</nowiki> of category links to an honor's master awards. | ||
+ | |||
+ | ==Example== | ||
+ | <nowiki>{{GetMasterCategoryList</nowiki><br/> | ||
+ | |category=Arts, Crafts and Hobbies<br/> | ||
+ | |master=Crime<br/> | ||
+ | |master2=Punishment<br/> | ||
+ | |mastergroup=flora}}<br/> | ||
+ | |||
{{GetMasterCategoryList | {{GetMasterCategoryList | ||
|category=Arts, Crafts and Hobbies | |category=Arts, Crafts and Hobbies | ||
Line 5: | Line 14: | ||
|master2=Punishment | |master2=Punishment | ||
|mastergroup=flora}} | |mastergroup=flora}} | ||
+ | |||
+ | ==Mechanics== | ||
+ | The output list is stored in a variable called ''mlist'' (master list) and that is emitted at the end of the template. | ||
+ | |||
+ | It starts by looking at the {{{category}}} parameter and assigning a mlist to one of the category-based Master Awards. Not every honor category results in a Master Award, so the switch statement doesn't deal with all of the known categories. In other words, mlist may or may not be empty when we come out of the switch statement. | ||
+ | |||
+ | It then looks to see if the {{{master}}} argument specified that the honor is part of some other Master Award, and if it is, it adds that to mlist. If mlist already has something assigned to it, the code will append mlist with a <nowiki><br/></nowiki> tag before appending the master award category. It then repeats that logic using {{{master2}}}. | ||
+ | |||
+ | |||
</noinclude><includeonly>{{#switch:{{{category}}} | </noinclude><includeonly>{{#switch:{{{category}}} | ||
| Arts and Crafts ={{#vardefine:mlist|[[:Category:AY Honors/Artisan Master Award{{!}}Artisan Master Award]]}} | | Arts and Crafts ={{#vardefine:mlist|[[:Category:AY Honors/Artisan Master Award{{!}}Artisan Master Award]]}} |
Revision as of 21:49, 14 January 2021
This template outputs a <br/>-separated of category links to an honor's master awards.
Example
{{GetMasterCategoryList
|category=Arts, Crafts and Hobbies
|master=Crime
|master2=Punishment
|mastergroup=flora}}
Artisan Master Award
Crime Master Award
Punishment Master Award
Mechanics
The output list is stored in a variable called mlist (master list) and that is emitted at the end of the template.
It starts by looking at the {{{category}}} parameter and assigning a mlist to one of the category-based Master Awards. Not every honor category results in a Master Award, so the switch statement doesn't deal with all of the known categories. In other words, mlist may or may not be empty when we come out of the switch statement.
It then looks to see if the {{{master}}} argument specified that the honor is part of some other Master Award, and if it is, it adds that to mlist. If mlist already has something assigned to it, the code will append mlist with a <br/> tag before appending the master award category. It then repeats that logic using {{{master2}}}.