Difference between revisions of "Template:Map caption"

From blackwiki
Jump to navigation Jump to search
imported>SomeHuman
(rm margin-top:3px;margin-bottom:-3px; because such is now handled at proper place, the calling Infobox Countries, for which map_caption had adjusted)
imported>Galobtter
(fix spacing)
 
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<noinclude>{{Intricate}}
+
<div style="text-align:center;line-height:1.15em;">Location of{{#if:{{{countryprefix|}}}
<div style="width:100%;text-align:center;font-size:9px;line-height:1.2em;"><div style="width:80%;background-color:#808080;color:#ffffff;text-align:center;">template output (without input parameters) start</div></div></noinclude><!--
+
|&nbsp;{{{countryprefix}}}
 
+
}}&nbsp;{{#ifexist:{{{country}}}
--><div style="text-align:center;font-size:11px;line-height:1.15em;"><span style="font-size:11px;">Location of <!--
+
|[[{{{country}}}]]
-->{{#if:<!--[0]-->{{{countryprefix|}}}
+
|{{{country|{{PAGENAME}}}}}
      |<!--then:[0]-->{{{countryprefix}}}&nbsp;<!--
+
}}{{#ifeq:{{{location|{{{location_color|any}}}}}}|none|
--end#if:[0]-->}}<span style="font-size:2px;">&nbsp;</span>{{#ifexist:{{{country}}}|[[{{{country}}}]]|{{{country|[[{{PAGENAME}}]]}}}}}<!--
+
|&nbsp;({{{location|{{{location_color|orange}}}}}})
-->{{#ifeq:<!--[1]-->{{{location|{{{location_color|any}}}}}}|<!--equals:-->none
+
}}{{#if:{{{region|{{{legend|}}}}}}
      |<!--then:[1] either location or location_color passed as explicit demand not to indicate any (default location_color) value
+
|{{#if:{{{subregion|}}}
  -->|<!--else:[1]--><span style="font-size:8px;">{{spaces|2}}</span>({{{location|<span style="font-size:9px;">{{{location_color|orange}}}</span>}}})<!--
+
  |<p style="text-align:left;margin-left:1.2ex;margin-top:0px;margin-bottom:0px;line-height:1.15em;">–&nbsp;
--end#ifeq:[1]-->}}</span><!--
+
  |<p style="text-align:center;margin-top:0px;margin-bottom:0px;line-height:1.15em;">
-->{{#if:<!--[2]-->{{{region|{{{legend|}}}}}}
+
}}{{#switch:{{{region|none}}}
      |<!--then:[2]
+
  | none =
-->{{#if:<!--[3]-->{{{subregion|}}}
+
  | Europe
      |<!--then:[3]--><p style="width:250px;font-size:11px;text-align:left;margin-left:1.2ex;margin-top:0px;margin-bottom:0px;line-height:1.15em;">–&nbsp;<!--
+
  | [[Europe]]
  -->|<!--else:[3]--><p style="width:250px;font-size:11px;text-align:center;margin-top:0px;margin-bottom:0px;line-height:1.15em;"><!--
+
  | in Europe
--end#if:[3]-->}}<!--
+
  | in [[Europe]]
-->{{#switch:<!--[4]-->{{{region|none}}}
+
  | on the European continent
| none =
+
  | on the [[Europe|European continent]] = in [[Europe]]
| Europe
+
  | Pacific
| [[Europe]]
+
  | [[Pacific]]
| in Europe
+
  | the Pacific
| in [[Europe]]
+
  | the [[Pacific]]
| on the European continent
+
  | the Pacific Ocean = in the [[Pacific Ocean]]
| on the [[Europe|European continent]] = on the [[Europe|European continent]]
+
  | Middle East
| Pacific
+
  | [[Middle East]]
| [[Pacific]]
+
  | Arctic Circle
| the Pacific
+
  | [[Arctic Circle]]
| the [[Pacific]]
+
  | Pacific Ocean
| the Pacific Ocean = in the [[Pacific Ocean]]
+
  | [[Pacific Ocean]] = in the {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
| Antarctica
+
  | #default = in {{#ifexist:{{{region}}}
| [[Antarctica]] = on {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
+
  |[[{{{region}}}]]
| Middle East
+
  |{{{region}}}
| [[Middle East]]
+
  }}
| Arctic Circle
+
}}{{#if:{{{region|}}}
| [[Arctic Circle]]
+
  |{{#ifeq:{{{region_color|any}}}|none|
| Pacific Ocean
+
  |&nbsp;({{#if:{{{subregion|}}}
| [[Pacific Ocean]] = in the {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
+
    |{{#ifeq:{{{subregion_color|tan}}}|{{{region_color|white}}}|
| #default = in {{#ifexist:{{{region}}}|[[{{{region}}}]]|{{{region}}}}}
+
    |{{#ifeq:{{{subregion_color|any}}}|none|
<!--end#switch:[4]-->}}<!--
+
      |{{{subregion_color|tan}}} &&nbsp;
-->{{#if:<!--[5]-->{{{region|}}}
+
    }}
      |<!--then:[5]
+
    }}
-->{{#ifeq:<!--[6]-->{{{region_color|any}}}|<!--equals:-->none
+
  }}{{{region_color|white}}})
      |<!--then:[6] region_color passed as explicit demand not to indicate (default) color
+
  }}{{#if:{{{subregion|}}}
  -->|<!--else:[6]--><span style="font-size:8px;">{{spaces|2}}</span>(<span style="font-size:9px;"><!--
+
  |<br />–&nbsp;{{#switch:{{{subregion|none}}}
-->{{#if:<!--[7]-->{{{subregion|}}}
+
    | EU
      |<!--then:[7]
+
    | [[EU]]
-->{{#ifeq:<!--[8]-->{{{subregion_color|camel}}}|<!--equals:-->{{{region_color|white}}}
+
    | the EU
      |<!--then:[8] mention colour once
+
    | the [[EU]]
  -->|<!--else:[8]
+
    | European Union
-->{{#ifeq:<!--[8a]-->{{{subregion_color|any}}}|<!--equals:-->none
+
    | [[European Union]]
      |<!--then:[8a] mention the one colour
+
    | the European Union
  -->|<!--else:[8a]-->{{{subregion_color|camel}}} &&nbsp;<!--
+
    | the [[European Union]] = in the [[European Union]]
--end#ifeq:[8a]-->}}<!--
+
    | #default = in {{#ifexist:{{{subregion}}}
--end#ifeq:[8]-->}}{{{region_color|white}}}<!--
+
    |[[{{{subregion}}}]]
  -->|<!--else:[7]-->{{{region_color|white}}}<!--
+
    |{{{subregion}}}
--end#if:[7]-->}}</span>)<!--
+
    }}
--end#if:[6]-->}}<!--
+
  }}{{#ifeq:{{{subregion_color|any}}}|none|
-->{{#if:<!--[9]-->{{{subregion|}}}
+
    |&nbsp;({{{subregion_color|tan}}})
      |<!--then:[9]--><br />–&nbsp;<!--
+
  }}
-->{{#switch:<!--[10]-->{{{subregion|none}}}
+
  }}
| EU
+
}}{{#if:{{{legend|}}}
| [[EU]]
+
  |{{#switch:<!--[13]-->{{{subregion|none}}}
| the EU
+
  | EU
| the [[EU]]
+
  | [[EU]]
| European Union
+
  | the EU
| [[European Union]]
+
  | the [[EU]]
| the European Union
+
  | European Union
| the [[European Union]] = in the [[European Union]]
+
  | [[European Union]]
| #default = in {{#ifexist:{{{subregion}}}|[[{{{subregion}}}]]|{{{subregion}}}}}
+
  | the European Union
<!--end#switch[10]-->}}<!--
+
  | the [[European Union]] = {{#ifeq:{{{subregion_color|tan}}}|tan
-->{{#ifeq:<!--[11]-->{{{subregion_color|any}}}|<!--equals:-->none
+
    |&nbsp;
      |<!--then:[11] subregion_color passed as explicit demand not to indicate (default) color
+
    |&nbsp; –&nbsp;
  -->|<!--else:[11]--><span style="font-size:8px;">{{spaces|2}}</span>(<span style="font-size:9px;">{{{subregion_color|camel}}}</span>)<!--
+
  }}
--end#if:[11]-->}}<!--
+
  | none = {{#ifeq:{{{region|none}}}|none|
--end#if:[9]-->}}<!--else:[5] no region thus no SUBregion acceptable (hence no colours indicating region or subregion at region)
+
    |&nbsp; –&nbsp;  
--end#if:[5]-->}}<!--
+
  }}
-->{{#if:<!--[12]-->{{{legend|}}}
+
  | #default = &nbsp; –&nbsp;
      |<!--then[12]:
+
  }} &#91;[[:File:{{{legend}}}|Legend]]&#93;
-->{{#switch:<!--[13]-->{{{subregion|none}}}
+
}}</p>
| EU
+
}}</div><noinclude>
| [[EU]]
+
{{documentation}}
| the EU
 
| the [[EU]]
 
| European Union
 
| [[European Union]]
 
| the European Union
 
| the [[European Union]] = <!--
 
-->{{#ifeq:<!--[13a]-->{{{subregion_color|camel}}}|<!--equals:-->camel
 
      |<!--then:[13a]-->{{spaces|16}}&thinsp;<!--
 
  -->|<!--else:[13a]-->&nbsp; —&nbsp;<!--
 
--end#ifeq:[13a]-->}}
 
| none = <!--
 
-->{{#ifeq:<!--[14]-->{{{region|none}}}|<!--equals:-->none
 
      |<!--then:[14] no spacer while legend has line all for itself
 
  -->|<!--else:[14]-->&nbsp; —&nbsp;<!--
 
--end#ifeq:[14]-->}}
 
| #default = &nbsp; —&nbsp;
 
<!--end#switch:[13]-->}} &#91;<span style="font-size:10px;">[[:Image:{{{legend}}}|Legend]]</span>&#93;<!--
 
--end#if:[12]-->}}</p><!--
 
--end#if:[2]-->}}</div><noinclude>
 
 
 
<div style="width:100%;text-align:center;font-size:9px;line-height:1.2em;"><div style="width:80%;background-color:#808080;color:#ffffff;text-align:center;">template output end<br/>note that it is ''supposed'' to be cut off at the bottom</div></div>
 
<br/>{{template doc}}
 
 
</noinclude>
 
</noinclude>

Latest revision as of 17:46, 23 March 2019

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)

in Europe (white)  –  [Legend]

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

– in Europe (tan & white)
– in the European Union (tan)  [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)

– in Europe (tan & white)
– in the European Union (tan)  [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)

in Europe (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)

– in Europe (tan & white)
– in the European Union (tan)  [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]]