Difference between revisions of "Template:GetPreferredVariant"

From Pathfinder Wiki
 
Line 1: Line 1:
<includeonly>{{#vardefine:country|{{GetUserData|data=Country|alt=none}}}}{{#vardefine:conference|{{GetUserData|data=Conference|alt=none}}}}{{#vardefine:union|{{GetUserData|data=Union|alt=none}}}}{{#vardefine:division|{{GetUserData|data=Division|alt=none}}}}{{#if:{{#pos:{{{variants}}}|{{#var:country}}}}|{{#var:country}}|{{#if:{{#pos:{{{variants}}}|{{#var:conference}}}}|{{#var:conference}}|{{#if:{{#pos:{{{variants}}}|{{#var:union}}}}|{{#var:union}}|{{#if:{{#pos:{{{variants}}}|{{#var:division}}}}|{{#var:division}}|{{#if:{{#pos:{{{variants}}}|General Conference}}|General Conference}}}}}}}}}}{{#if:{{{debug|}}}|
+
<includeonly>{{#vardefine:variants|{{{variants}}};;}}{{#vardefine:country|{{GetUserData|data=Country|alt=none}}}}{{#vardefine:conference|{{GetUserData|data=Conference|alt=none}}}}{{#vardefine:union|{{GetUserData|data=Union|alt=none}}}}{{#vardefine:division|{{GetUserData|data=Division|alt=none}}}}{{#if:{{#pos:{{#var:variants}}|{{#var:country}};;}}|{{#var:country}}|{{#if:{{#pos:{{#var:variants}}|{{#var:conference}};;}}|{{#var:conference}}|{{#if:{{#pos:{{#var:variants}}|{{#var:union}};;}}|{{#var:union}}|{{#if:{{#pos:{{#var:variants}}|{{#var:division}};;}}|{{#var:division}}|{{#if:{{#pos:{{#var:variants}}|General Conference;;}}|General Conference}}}}}}}}}}
 +
{{#if:{{{debug|}}}|
 
*variants={{{variants}}}
 
*variants={{{variants}}}
 +
*var:variants={{#var:variant}}
 
*country={{#var:country}}
 
*country={{#var:country}}
 
*conference={{#var:conference}}
 
*conference={{#var:conference}}
Line 10: Line 12:
  
 
==Examples==
 
==Examples==
*<nowiki>{{</nowiki>GetPreferredVariant|variants=Bermuda,Canada,United States}} &rarr; {{GetPreferredVariant|variants=Bermuda,Canada,United States}}
+
*<nowiki>{{</nowiki>GetPreferredVariant|variants=Bermuda,Canada,United States}} &rarr; {{GetPreferredVariant|variants=Bermuda;;Canada;;United States}}
*<nowiki>{{</nowiki>GetPreferredVariant|variants=North American Division,General Conference,Atlantic Union,Northern New England}} &rarr; {{GetPreferredVariant|variants=North American Division,General Conference,Atlantic Union,Northern New England}}
+
*<nowiki>{{</nowiki>GetPreferredVariant|variants=North American Division;;General Conference;;Atlantic Union;;Northern New England}} &rarr; {{GetPreferredVariant|variants=North American Division;;General Conference;;Atlantic Union;;Northern New England}}
*<nowiki>{{</nowiki>GetPreferredVariant|variants=North American Division,General Conference,Atlantic Union}} &rarr; {{GetPreferredVariant|variants=North American Division,General Conference,Atlantic Union}}
+
*<nowiki>{{</nowiki>GetPreferredVariant|variants=North American Division;;General Conference;;Atlantic Union}} &rarr; {{GetPreferredVariant|variants=North American Division;;General Conference;;Atlantic Union}}
*<nowiki>{{</nowiki>GetPreferredVariant|variants=North American Division,General Conference}} &rarr; {{GetPreferredVariant|variants=North American Division,General Conference}}
+
*<nowiki>{{</nowiki>GetPreferredVariant|variants=North American Division;;General Conference}} &rarr; {{GetPreferredVariant|variants=North American Division;;General Conference}}
*<nowiki>{{</nowiki>GetPreferredVariant|variants=South American Division,General Conference}} &rarr; {{GetPreferredVariant|variants=South American Division,General Conference}}
+
*<nowiki>{{</nowiki>GetPreferredVariant|variants=South American Division;;General Conference}} &rarr; {{GetPreferredVariant|variants=South American Division;;General Conference}}
  
 
</noinclude>
 
</noinclude>

Latest revision as of 22:32, 10 April 2021

This template accepts a comma-deliniated list of honor variants and compares them to the user's profile data. It returns the lowest-level variant (country, conference, union, division, GC) that matches the user's profile. This can be used to decide which requirements to show, or which answer key to feature, etc.

Examples

  • {{GetPreferredVariant|variants=Bermuda,Canada,United States}} →
  • {{GetPreferredVariant|variants=North American Division;;General Conference;;Atlantic Union;;Northern New England}} → General Conference
  • {{GetPreferredVariant|variants=North American Division;;General Conference;;Atlantic Union}} → General Conference
  • {{GetPreferredVariant|variants=North American Division;;General Conference}} → General Conference
  • {{GetPreferredVariant|variants=South American Division;;General Conference}} → General Conference