Difference between revisions of "Template:GetHonorMetaData"

From Pathfinder Wiki
(Created page with "<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{GetLandingPage}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}|{{#explode:...")
 
Line 1: Line 1:
 
<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{GetLandingPage}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}|{{#explode:{{#var:page}}|(|0}}|{{#var:page}}}}}}{{#vardefine:landingpage|{{#titleparts:{{#var:srcpage}}|2}}}}{{#vardefine:pvalue|{{#dpl:title={{#var:landingpage}}|include={{{{template|HonorLanding}}}}:{{{parameter|honorname}}}}}}}{{#vardefine:output|{{#if:{{{english|}}}|{{#var:pvalue}}|{{#if:{{#var:pvalue}}|{{#lst:Localization:All{{GetLangSuffix}}|{{#var:pvalue}}}}}}}}}}{{#if:{{#var:output}}|{{#var:output}}|{{#var:pvalue}}}}
 
<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{GetLandingPage}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}|{{#explode:{{#var:page}}|(|0}}|{{#var:page}}}}}}{{#vardefine:landingpage|{{#titleparts:{{#var:srcpage}}|2}}}}{{#vardefine:pvalue|{{#dpl:title={{#var:landingpage}}|include={{{{template|HonorLanding}}}}:{{{parameter|honorname}}}}}}}{{#vardefine:output|{{#if:{{{english|}}}|{{#var:pvalue}}|{{#if:{{#var:pvalue}}|{{#lst:Localization:All{{GetLangSuffix}}|{{#var:pvalue}}}}}}}}}}{{#if:{{#var:output}}|{{#var:output}}|{{#var:pvalue}}}}
 
</includeonly><noinclude>
 
</includeonly><noinclude>
This template returns the value of a parameter as defined in a template on a given honor landing page.  It takes up to four arguments:
+
This template returns the value of a parameter as defined in a template on a given honor landing page.  Unless told otherwise, it will localize the parameter value into the language of the invoking page.  If no localization for the parameter value exists, it will return the parameter as it exists in the honor's landing page in the source language.
;page|honor: You can specify either the page or the honor.  If you specify both it will use page.  The page argument is the page title of an honor or one of its subpages.  It accepts translated pages, but ignores that since the metadata is in the honor's "source" page which is in English.  This could give problems when trying to fetch an honorname.  If you need the translated version of any other parameter, you should be able to use [[:Template:Localize]] to convert it.
+
 
 +
It takes up to four arguments:
 +
;page|honor: You can specify either the page or the honor.  If you specify both it will use page.  If you specify neither, it will assume you are on an honor page or subpage and treat the first two elements of the invoking page's title as the page.  The page argument is the page title of an honor or one of its subpages.   
 
;template: If omitted, this will specify which template holds the parameter you want.  It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
 
;template: If omitted, this will specify which template holds the parameter you want.  It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
;parameter: This specifies which parameter of template you want the template to return. It will always return the English value of the parameter.  Again... [[:Template:Localize]] is your friend, but note that Localize only works on a translate page (or we'd demonstrate it here).
+
;parameter: This specifies which parameter of template you want the template to return.
 +
;english: If supplied and set to anything other than an empty string, the template will not translate the value of the parameter setting into the translation language of the invoking pageInstead, it will force it to the untranslated English.
  
 
==Examples==
 
==Examples==

Revision as of 03:56, 23 March 2021

This template returns the value of a parameter as defined in a template on a given honor landing page. Unless told otherwise, it will localize the parameter value into the language of the invoking page. If no localization for the parameter value exists, it will return the parameter as it exists in the honor's landing page in the source language.

It takes up to four arguments:

page|honor
You can specify either the page or the honor. If you specify both it will use page. If you specify neither, it will assume you are on an honor page or subpage and treat the first two elements of the invoking page's title as the page. The page argument is the page title of an honor or one of its subpages.
template
If omitted, this will specify which template holds the parameter you want. It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
parameter
This specifies which parameter of template you want the template to return.
english
If supplied and set to anything other than an empty string, the template will not translate the value of the parameter setting into the translation language of the invoking page. Instead, it will force it to the untranslated English.

Examples

  • {{GetHonorMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} → Recreation
  • {{GetHonorMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} → 1
  • {{GetHonorMetaData|honor=Camping Skills III|parameter=authority}} → General Conference
  • {{GetHonorMetaData|honor=Animal Tracking (General Conference)|parameter=year}} → 1976
  • {{GetHonorMetaData|honor=Currency|parameter=year|template=User:DesignerThan/Sandbox/LandingPage}} →