Difference between revisions of "Template:Map caption"

From blackwiki
Jump to navigation Jump to search
imported>SomeHuman
(correct syntax)
imported>SomeHuman
(Template now automatically puts a link at the optionally passed 'country' and at 'region' as well as at 'subregion' in case an article or redirect by the respective name exists;)
Line 2: Line 2:
 
-->{{#if:<!--[0]-->{{{countryprefix|}}}
 
-->{{#if:<!--[0]-->{{{countryprefix|}}}
 
       |<!--then:[0]-->{{{countryprefix}}}&nbsp;<!--
 
       |<!--then:[0]-->{{{countryprefix}}}&nbsp;<!--
--end#if:[0]-->}}<span style="font-size:2px;">&nbsp;</span>[[{{{country|{{PAGENAME}}}}}]]<!--
+
--end#if:[0]-->}}<span style="font-size:2px;">&nbsp;</span>{{#ifexist:{{{country}}}|[[{{{country}}}]]|{{{country|[[{{PAGENAME}}]]}}}}}<!--
 
-->{{#ifeq:<!--[1]-->{{{location|{{{location_color|any}}}}}}|<!--equals:-->none
 
-->{{#ifeq:<!--[1]-->{{{location|{{{location_color|any}}}}}}|<!--equals:-->none
 
       |<!--then:[1] either location or location_color passed as explicit demand not to indicate any (default location_color) value
 
       |<!--then:[1] either location or location_color passed as explicit demand not to indicate any (default location_color) value
Line 27: Line 27:
 
| the Pacific Ocean = in the [[Pacific Ocean]]
 
| the Pacific Ocean = in the [[Pacific Ocean]]
 
| Antarctica
 
| Antarctica
| [[Antarctica]] = on {{{region}}}
+
| [[Antarctica]] = on {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
 
| Middle East
 
| Middle East
 
| [[Middle East]]
 
| [[Middle East]]
Line 33: Line 33:
 
| [[Arctic Circle]]
 
| [[Arctic Circle]]
 
| Pacific Ocean
 
| Pacific Ocean
| [[Pacific Ocean]] = in the {{{region}}}
+
| [[Pacific Ocean]] = in the {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
| #default = in {{{region}}}
+
| #default = in {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
 
<!--end#switch:[4]-->}}<!--
 
<!--end#switch:[4]-->}}<!--
 
-->{{#if:<!--[5]-->{{{region|}}}
 
-->{{#if:<!--[5]-->{{{region|}}}
Line 83: Line 83:
 
| [[European Union]]
 
| [[European Union]]
 
| the European Union  
 
| the European Union  
| the [[European Union]] = {{spaces|17}}
+
| the [[European Union]] = <!--
 +
-->{{#ifeq:<!--[13a]-->{{{subregion_color|orange}}}|<!--equals:-->orange
 +
      |<!--then:[13a]-->{{spaces|17}}<!--
 +
  -->|<!--else:[13a]-->&nbsp; —&nbsp;<!--
 +
--end#ifeq:[13a]-->}}
 
| none = <!--
 
| none = <!--
 
-->{{#ifeq:<!--[14]-->{{{region|none}}}|<!--equals:-->none
 
-->{{#ifeq:<!--[14]-->{{{region|none}}}|<!--equals:-->none

Revision as of 20:40, 13 March 2007

Location of  Map caption  (orange)


Template documentation[view] [edit] [history] [purge]

Template intended to simplify adding a standardized and formatted caption below a map indicating the location of something (e.g. a country), possibly referring to the map's main region and optionally also to a shown subregion. Original use within infoboxes (e.g. see articles on European countries). For a complete set of elements of reasonable length, a width of (minimally) 250px (without extra padding or margins) should be available.

Parameters

Required parameters shown in bold italics Script error: No such module "aligned table".

Note 
If country, region or subregion is exactly the name of a page in article space, the template automatically creates a link to it. You can still put a link here manually, using the usual syntax.

Examples

Code Raw result (in unformatted box, compare to handling in Infobox)
{{map caption}}
Location of  Map caption  (orange)
{{map caption |region=Europe |legend=European location legend en.png}}
Location of  Map caption  (orange)

on the European continent  (white)  —  [Legend]

{{map caption |countryprefix=the |region=Europe |subregion=the [[European Union]] |legend=European location legend en.png}}
Location of the  Map caption  (orange)

– on the European continent  (white)
– in the European Union  (camel)                  [Legend]

 Typical sample for an article on a European Union member that needs no "the" before its name, for otherwise identical output:
{{map caption |region=Europe |subregion=EU |legend=European location legend en.png}}
Location of  Map caption  (orange)

– on the European continent  (white)
– in the European Union  (camel)                  [Legend]

Infobox usage of code (as intended) — in which the alignment, the padding/margins, and font are rendered differently (this template adjusts for that infobox):
Sample for article named 'Armenia', about a non-European country

{{Infobox Country or territory|
|common_name = Armenia
|image_map = Europe location ARM.png
|map_caption = {{map caption}}
|(some required infobox parameters omitted from sample)
}}


Sample for article named 'Belarus', about a non-member of the EU
{{Infobox Country or territory|
|common_name = Belarus
|image_map = Europe location BLR.png
|map_caption = {{map caption |region=Europe |legend=European location legend en.png}}
|(some required infobox parameters omitted from sample)
}}


Sample for article named 'Netherlands', about a member of the EU
{{Infobox Country or territory|
|common_name = the Netherlands
|image_map = EU location NED.png
|map_caption = {{map caption |countryprefix=the |region=Europe |subregion=the [[European Union]] |legend=European location legend en.png}}
|(some required infobox parameters omitted from sample)
}}

Net result — The three simplified samples above, shown here side by side
Net result — (called here without country parameter, and with placeholder values for population to prevent error messages):
Location of Armenia
Location of  Map caption  (orange)
Capitalx
Official languages x
Government x
Area
 -  Total 10 km² 
0 sq mi 
 -  Density 10 /km² (0)
0 /sq mi
Currency x (x)
Time zone x (UTC0)
Internet TLD x
Calling code [[+0]]
Location of Belarus
Location of  Map caption  (orange)

on the European continent  (white)  —  [Legend]

Capitalx
Official languages x
Government x
Area
 -  Total 10 km² 
0 sq mi 
 -  Density 10 /km² (0)
0 /sq mi
Currency x (x)
Time zone x (UTC0)
Internet TLD x
Calling code [[+0]]
Location of the Netherlands
Location of the  Map caption  (orange)

– on the European continent  (white)
– in the European Union  (camel)                  [Legend]

Capitalx
Official languages x
Government x
Area
 -  Total 10 km² 
0 sq mi 
 -  Density 10 /km² (0)
0 /sq mi
Currency x (x)
Time zone x (UTC0)
Internet TLD x
Calling code [[+0]]