Difference between revisions of "Template:GetHonorSeeAlso"

From Pathfinder Wiki
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
Displays a list of all the honors tagged as a "See Also" for which the specified honor. This includes all pages for which it is listed as a prerequisite, as well as any that are adjacent in a series labelled with Roman numerals. Every Honor-Link is separated by "%|%".  
+
Displays a list of all the honors tagged as a "See Also" for which the specified honor. This includes all pages for which it is listed as a prerequisite, as well as any that are adjacent in a series labelled with Roman numerals. Every Honor-Link is separated by "%|%".  
  
 
==Parameters==
 
==Parameters==
;honorname: This parameter specifies the name of the honor. If omitted, the template assumes the can be found as the second element of the page title invoking the template.
+
;honorname: This parameter specifies the name of the honor. If omitted, the template assumes the can be found as the second element of the page title invoking the template.
  
This template is related to [[:Template:Honor prerequisite]] which is used as the answer to most requirements to earn some other honor. That template will add whatever invokes it to <nowiki>[[</nowiki>Category:AY Honors/See Also/''honor'']], where ''honor'' is the prerequisite. Every honor in that category has ''honor'' as a prerequisite or is related to ''honor'' in some other way (such as being the adjacent in a series. This template merely lists all the honors in that category to indicate that once you've earned this one, you're partway to earning another.
+
This template is related to [[:Template:Honor prerequisite]] which is used as the answer to most requirements to earn some other honor. That template will add whatever invokes it to <nowiki>[[</nowiki>Category:AY Honors/See Also/''honor'']], where ''honor'' is the prerequisite. Every honor in that category has ''honor'' as a prerequisite or is related to ''honor'' in some other way (such as being the adjacent in a series. This template merely lists all the honors in that category to indicate that once you've earned this one, you're partway to earning another.
  
 
==Example==
 
==Example==
 
<div class="toccolours">
 
<div class="toccolours">
:<nowiki>{{</nowiki>GetHonorSeeAlso|honorname=Camping Skills IV}}
+
:<nowiki>{{</nowiki>GetHonorSeeAlso|honorname=Basic Water Safety/es}}
 
</div>
 
</div>
  
{{GetHonorSeeAlso|honorname=Camping Skills IV}}
+
{{GetHonorSeeAlso|honorname=Basic Water Safety/es|debug=1}}
 +
 
 +
 
 +
<div class="toccolours">
 +
:<nowiki>{{</nowiki>GetHonorSeeAlso|honorname=Edible Wild Plants}}
 +
</div>
 +
 
 +
{{GetHonorSeeAlso|honorname=Edible Wild Plants|debug=1}}
  
 
==Mechanics==
 
==Mechanics==
First define a variable for honorname. If the honorname parameter is specified, it gets used. Otherwise, it extracts the honorname from the second element of the page title.
+
First define a variable for honorname. If the honorname parameter is specified, it gets used. Otherwise, it extracts the honorname from the second element of the page title.
  
Next define the honor category honcat. We're looking for the category AY_Honors/See_Also/''honorname''/language. The honor specified by honorname is related to every honor in this category, such as if it is a prerequisite, or if it is adjacent in a series.
+
Next define the honor category honcat. We're looking for the category AY_Honors/See_Also/''honorname''/language. The honor specified by honorname is related to every honor in this category, such as if it is a prerequisite, or if it is adjacent in a series.
  
Then define an IA category. This honor is related to the IA pages in the category AY_Honors/Prerequisite_IA/''honorname''/language.
+
Then define an IA category. This honor is related to the IA pages in the category AY_Honors/Prerequisite_IA/''honorname''/language.
  
 
If honcat has any pages in it, we create a variable dplList, which is the output of a dpl query.
 
If honcat has any pages in it, we create a variable dplList, which is the output of a dpl query.
 
We then enter a loop, converting the list of dpl hist into dplItems, formatted into a link with the translated honorname as the link display.
 
We then enter a loop, converting the list of dpl hist into dplItems, formatted into a link with the translated honorname as the link display.
  
This is repeated for iacat. (well... it used to be. Still need to add this back)
+
This is repeated for iacat. (well... it used to be. Still need to add this back)
  
Of special note is that the dpl is using categorymatch instead of category. The reason for this is because category can specify multiple categories using the "&" character as a delimiter, and some honornames (I'm looking at you Tumbling & Balancing) have & in them. This has tragic consequences for dpl's category specifier. The categorymatch specifier is very much like category, except that it can use % as a wildcard - using the same format as an SQL LIKE statement. If there are no % wildcards, then it's largely the same as category, except that categorymatch does not recognize & as a delimiter.
+
Of special note is that the dpl is using categorymatch instead of category. The reason for this is because category can specify multiple categories using the "&" character as a delimiter, and some honornames (I'm looking at you Tumbling & Balancing) have & in them. This has tragic consequences for dpl's category specifier. The categorymatch specifier is very much like category, except that it can use % as a wildcard - using the same format as an SQL LIKE statement. If there are no % wildcards, then it's largely the same as category, except that categorymatch does not recognize & as a delimiter.
  
 
That bug took half a week to track down and slay.
 
That bug took half a week to track down and slay.
  
 
</noinclude><includeonly>{{#vardefine:honorname|{{{honorname|{{#titleparts:{{PAGENAME}}|1|2}} }}} }}{{#vardefine:honcat|AY Honors/See Also/{{#var:honorname}}{{GetLangSuffix}}}}{{#vardefine:iacat|AY Honors/Prerequisite IA/{{#var:honorname}}{{GetLangSuffix}}}}{{#vardefine:honcatsize|{{PAGESINCATEGORY:{{#var:honcat}}}}}}{{#if:{{#var:honcatsize}}
 
</noinclude><includeonly>{{#vardefine:honorname|{{{honorname|{{#titleparts:{{PAGENAME}}|1|2}} }}} }}{{#vardefine:honcat|AY Honors/See Also/{{#var:honorname}}{{GetLangSuffix}}}}{{#vardefine:iacat|AY Honors/Prerequisite IA/{{#var:honorname}}{{GetLangSuffix}}}}{{#vardefine:honcatsize|{{PAGESINCATEGORY:{{#var:honcat}}}}}}{{#if:{{#var:honcatsize}}
     |{{#vardefine:dplList
+
     |{{#vardefine:dplHonList
 
                   |{{#dpl:format=,%PAGE%,%{{!}}%
 
                   |{{#dpl:format=,%PAGE%,%{{!}}%
 
                         |categorymatch={{#replace:{{#var:honcat}}|&|%}}
 
                         |categorymatch={{#replace:{{#var:honcat}}|&|%}}
Line 42: Line 49:
 
               |0
 
               |0
 
               |{{#var:honcatsize}}
 
               |{{#var:honcatsize}}
               |{{#vardefine:dplItem|{{#explode:{{#var:dplList}}|%{{!}}%|{{#var:index}}}}}}
+
               |{{#vardefine:dplItem|{{#explode:{{#var:dplHonList}}|%{{!}}%|{{#var:index}}}}}}
 
                 {{#if:{{#var:dplItem}}
 
                 {{#if:{{#var:dplItem}}
                     |[[{{#titleparts:{{#var:dplItem}}|2}}{{!}}{{GetHonorName|page={{#var:dplItem}}}}]]%{{!}}%}}}}}}{{#vardefine:iacatsize|{{PAGESINCATEGORY:{{#var:iacat}}}}}}
+
                     |[[{{#titleparts:{{#var:dplItem}}|2}}{{GetLangSuffix}}{{!}}{{GetHonorName|page={{#var:dplItem}}}}]]%{{!}}%}}}}}}{{#vardefine:iacatsize|{{PAGESINCATEGORY:{{#var:iacat}}}}}}
 
{{#if:{{#var:iacatsize}}
 
{{#if:{{#var:iacatsize}}
     |{{#vardefine:dplList
+
     |{{#vardefine:dplIaList
 
                   |{{#dpl:format=,%PAGE%,%{{!}}%
 
                   |{{#dpl:format=,%PAGE%,%{{!}}%
 
                         |categorymatch={{#replace:{{#var:iacat}}|&|%}}
 
                         |categorymatch={{#replace:{{#var:iacat}}|&|%}}
Line 56: Line 63:
 
               |0
 
               |0
 
               |{{#var:iacatsize}}
 
               |{{#var:iacatsize}}
               |{{#vardefine:dplItem|{{#explode:{{#var:dplList}}|%{{!}}%|{{#var:index}}}}}}
+
               |{{#vardefine:dplItem|{{#explode:{{#var:dplIaList}}|%{{!}}%|{{#var:index}}}}}}
 
                 {{#if:{{#var:dplItem}}
 
                 {{#if:{{#var:dplItem}}
                     |[[{{#titleparts:{{#var:dplItem}}|2}}]]%{{!}}%}}
+
                     |[[{{#var:dplItem}}{{!}}{{Localize|{{#titleparts:{{#var:dplItem}}|1|2}}}}]]%{{!}}%}}
 
         }}
 
         }}
 
}}{{#if:{{{debug|}}}
 
}}{{#if:{{{debug|}}}
|
+
|<br/>
 
===Debug Info===
 
===Debug Info===
 +
*honcat={{#var:honcat}}
 +
*honcatsize={{#var:honcatsize}}
 +
*dplHonList={{#var:dplHonList}}
 
*iacat={{#var:iacat}}
 
*iacat={{#var:iacat}}
 
*iacatsize={{#var:iacatsize}}
 
*iacatsize={{#var:iacatsize}}
 +
*dplIaList={{#var:dplIaList}}
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 16:39, 7 October 2022

Displays a list of all the honors tagged as a "See Also" for which the specified honor. This includes all pages for which it is listed as a prerequisite, as well as any that are adjacent in a series labelled with Roman numerals. Every Honor-Link is separated by "%|%".

Parameters

honorname
This parameter specifies the name of the honor. If omitted, the template assumes the can be found as the second element of the page title invoking the template.

This template is related to Template:Honor prerequisite which is used as the answer to most requirements to earn some other honor. That template will add whatever invokes it to [[Category:AY Honors/See Also/honor]], where honor is the prerequisite. Every honor in that category has honor as a prerequisite or is related to honor in some other way (such as being the adjacent in a series. This template merely lists all the honors in that category to indicate that once you've earned this one, you're partway to earning another.

Example

{{GetHonorSeeAlso|honorname=Basic Water Safety/es}}

Swimming - Beginner%|% Friend%|%Voyager%|%Guide%|%Companion%|%Explorer%|%Ranger%|%

Debug Info

  • honcat=AY Honors/See Also/Basic Water Safety/es
  • honcatsize=1
  • dplHonList=AY Honors/Swimming - Beginner/es%|%
  • iacat=AY Honors/Prerequisite IA/Basic Water Safety/es
  • iacatsize=6
  • dplIaList=Investiture Achievement/Friend/Health and Fitness/es%|%Investiture Achievement/Voyager/Health and Fitness/es%|%Investiture Achievement/Guide/Health and Fitness/es%|%Investiture Achievement/Companion/Health and Fitness/es%|%Investiture Achievement/Explorer/Health and Fitness/es%|%Investiture Achievement/Ranger/Health and Fitness/es%|%


{{GetHonorSeeAlso|honorname=Edible Wild Plants}}

Wilderness Leadership - Advanced%|% Voyager%|%

Debug Info

  • honcat=AY Honors/See Also/Edible Wild Plants
  • honcatsize=1
  • dplHonList=AY Honors/Wilderness Leadership - Advanced/Answer Key%|%
  • iacat=AY Honors/Prerequisite IA/Edible Wild Plants
  • iacatsize=1
  • dplIaList=Investiture Achievement/Voyager/Nature Study%|%

Mechanics

First define a variable for honorname. If the honorname parameter is specified, it gets used. Otherwise, it extracts the honorname from the second element of the page title.

Next define the honor category honcat. We're looking for the category AY_Honors/See_Also/honorname/language. The honor specified by honorname is related to every honor in this category, such as if it is a prerequisite, or if it is adjacent in a series.

Then define an IA category. This honor is related to the IA pages in the category AY_Honors/Prerequisite_IA/honorname/language.

If honcat has any pages in it, we create a variable dplList, which is the output of a dpl query. We then enter a loop, converting the list of dpl hist into dplItems, formatted into a link with the translated honorname as the link display.

This is repeated for iacat. (well... it used to be. Still need to add this back)

Of special note is that the dpl is using categorymatch instead of category. The reason for this is because category can specify multiple categories using the "&" character as a delimiter, and some honornames (I'm looking at you Tumbling & Balancing) have & in them. This has tragic consequences for dpl's category specifier. The categorymatch specifier is very much like category, except that it can use % as a wildcard - using the same format as an SQL LIKE statement. If there are no % wildcards, then it's largely the same as category, except that categorymatch does not recognize & as a delimiter.

That bug took half a week to track down and slay.