Difference between revisions of "Template:Getalias2/doc"

From blackwiki
Jump to navigation Jump to search
imported>SiBr4
({{{Variant}}} documentation)
imported>SiBr4
m (→‎Examples: Update example)
Line 6: Line 6:
 
*<code>{{tnull|getalias2|Nepal|border}}</code> &rarr; <code>{{getalias2|Nepal|border}}</code> (nothing, since {{para|border}} is set to nothing in {{tl|Country data Nepal}})
 
*<code>{{tnull|getalias2|Nepal|border}}</code> &rarr; <code>{{getalias2|Nepal|border}}</code> (nothing, since {{para|border}} is set to nothing in {{tl|Country data Nepal}})
 
*<code>{{tnull|getalias2|Russia|border}}</code> &rarr; <code>{{getalias2|Russia|border}}</code> (no {{para|border}} parameter is defined in {{tl|Country data Russia}})
 
*<code>{{tnull|getalias2|Russia|border}}</code> &rarr; <code>{{getalias2|Russia|border}}</code> (no {{para|border}} parameter is defined in {{tl|Country data Russia}})
*<code>{{tnull|getalias2|Nepal|size}}</code> &rarr; <code>{{getalias2|Nepal|size}}</code> (in {{tl|Country data Nepal}}, the {{param|size}} parameter is passed through with fallback value 23x22px)
+
*<code>{{tnull|getalias2|Nepal|size}}</code> &rarr; <code>{{getalias2|Nepal|size}}</code> (in {{tl|Country data Nepal}}, the {{param|size}} parameter is passed through with fallback value 23x20px)
 
*<code>{{tnull|getalias2|Russia|size}}</code> &rarr; <code>{{getalias2|Russia|size}}</code> (in {{tl|Country data Russia}}, the {{param|size}} parameter is passed through with empty fallback value)
 
*<code>{{tnull|getalias2|Russia|size}}</code> &rarr; <code>{{getalias2|Russia|size}}</code> (in {{tl|Country data Russia}}, the {{param|size}} parameter is passed through with empty fallback value)
  

Revision as of 20:17, 29 June 2015

This is a more general version of {{Getalias}}, which can extract any parameter value from a country data template instead of just parameters named "... alias" or "... alias-...".

Examples

  • {{getalias2|United Kingdom|flag alias}}Flag of the United Kingdom.svg (the value of |flag alias= in {{Country data United Kingdom}})
  • {{getalias2|Georgia (U.S. state)|shortname alias}}Georgia (the value of |shortname alias= in {{Country data Georgia (U.S. state)}})
  • {{getalias2|Nepal|border}} (nothing, since |border= is set to nothing in {{Country data Nepal}})
  • {{getalias2|Russia|border}}{{{border}}} (no |border= parameter is defined in {{Country data Russia}})
  • {{getalias2|Nepal|size}} (in {{Country data Nepal}}, the {{{size}}} parameter is passed through with fallback value 23x20px)
  • {{getalias2|Russia|size}} (in {{Country data Russia}}, the {{{size}}} parameter is passed through with empty fallback value)

Usage with variant

The |variant= parameter can be used to extract a variant parameter value, and returns the main parameter value if the variant parameter is undefined:

  • {{getalias2|United Kingdom|flag alias|variant=civil}}Civil Ensign of the United Kingdom.svg (the value of |flag alias-civil=)
  • {{getalias2|United Kingdom|flag alias|variant=foo}}Flag of the United Kingdom.svg (non-existent variant; returns the value of |flag alias= as fallback)