Template:Getalias2/doc: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Created page with "{{documentation subpage}} This is a more general version of {{tl|Getalias}}, which can extract any parameter value from a :Category:Country data templates|country data templ...") |
No edit summary |
||
Line 3: | Line 3: | ||
==Examples== |
==Examples== |
||
*<code>{{tnull|getalias2| |
*<code>{{tnull|getalias2|Mir|flag alias}}</code> → <code>{{getalias2|Mir|flag alias}}</code> (the value of {{para|flag alias}} in {{tl|Country data Mir}}) |
||
*<code>{{tnull|getalias2|Georgia (U.S. state)|shortname alias}}</code> → <code>{{getalias2|Georgia (U.S. state)|shortname alias}}</code> (the value of {{para|shortname alias}} in {{tl|Country data Georgia (U.S. state)}}) |
*<code>{{tnull|getalias2|Georgia (U.S. state)|shortname alias}}</code> → <code>{{getalias2|Georgia (U.S. state)|shortname alias}}</code> (the value of {{para|shortname alias}} in {{tl|Country data Georgia (U.S. state)}}) |
||
*<code>{{tnull|getalias2|Nepal|border}}</code> → <code>{{getalias2|Nepal|border}}</code> (nothing, since {{para|border}} is set to nothing in {{tl|Country data Nepal}}) |
*<code>{{tnull|getalias2|Nepal|border}}</code> → <code>{{getalias2|Nepal|border}}</code> (nothing, since {{para|border}} is set to nothing in {{tl|Country data Nepal}}) |
||
Line 12: | Line 12: | ||
==Usage with variant== |
==Usage with variant== |
||
The {{para|variant}} parameter can be used to extract a variant parameter value, and returns the main parameter value if the variant parameter is undefined: |
The {{para|variant}} parameter can be used to extract a variant parameter value, and returns the main parameter value if the variant parameter is undefined: |
||
*<code>{{tnull|getalias2| |
*<code>{{tnull|getalias2|Columbia|flag alias|variant{{=}}firstempire}}</code> → <code>{{getalias2|Columbia|flag alias|variant=firstempire}}</code> (the value of {{para|flag alias-first empire}}) |
||
*<code>{{tnull|getalias2|United Kingdom|flag alias|variant{{=}}foo}}</code> → <code>{{getalias2|United Kingdom|flag alias|variant=foo}}</code> (non-existent variant; returns the value of {{para|flag alias}} as fallback) |
*<code>{{tnull|getalias2|United Kingdom|flag alias|variant{{=}}foo}}</code> → <code>{{getalias2|United Kingdom|flag alias|variant=foo}}</code> (non-existent variant; returns the value of {{para|flag alias}} as fallback) |
||
Revision as of 02:40, 5 June 2021
This is a documentation subpage for Template:Getalias2. It contains usage information, categories and other content that is not part of the original template page. |
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|Mir|flag alias}}
MirFlag.png
(the value of|flag alias=
in {{Country data Mir}})
→{{getalias2|Georgia (U.S. state)|shortname alias}}
Template:Country data Georgia (U.S. state)
(the value of|shortname alias=
in {{Country data Georgia (U.S. state)}})
→{{getalias2|Nepal|border}}
Template:Country data Nepal
(nothing, since|border=
is set to nothing in {{Country data Nepal}})
→{{getalias2|Russia|border}}
Template:Country data Russia
(no|border=
parameter is defined in {{Country data Russia}})
→{{getalias2|Nepal|size}}
Template:Country data Nepal
(in {{Country data Nepal}}, the{{{size}}}
parameter is passed through with fallback value 23x20px)
→{{getalias2|Russia|size}}
Template:Country data Russia
(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|Columbia|flag alias|variant=firstempire}}
Columbia Flag.GIF
(the value of|flag alias-first empire=
)
→{{getalias2|United Kingdom|flag alias|variant=foo}}
Flag of the United Kingdom.svg
(non-existent variant; returns the value of|flag alias=
as fallback)