Difference between revisions of "Template:Infobox islands/density"
Jump to navigation
Jump to search
imported>Yaris678 m (Changed protection level for "Template:Infobox islands/density": For consistency with Template:Infobox islands. An increase of edit protection and decrease of move protection. ([Edit=Require template editor access] (indefinite) [Move=Require t...) |
imported>Jonesey95 (spaces are not needed here) |
||
| Line 1: | Line 1: | ||
{{#if:{{{km2|}}} | {{#if:{{{km2|}}} | ||
|{{#if:{{{sqmi|}}}<!-- sqmi and km2 --> | |{{#if:{{{sqmi|}}}<!-- sqmi and km2 --> | ||
| − | |{{formatnum:{{{km2}}} | + | |{{formatnum:{{{km2}}}/km<sup>2</sup> ({{{sqmi}}}/sq mi)}} |
| − | |{{formatnum:{{{km2}}} | + | |{{formatnum:{{{km2}}}/km<sup>2</sup> ({{#expr: ({{formatnum:{{{km2}}}|R}})*2.58998811 round ({{precision|{{formatnum:{{{km2}}}|R}}}}-0)}}/sq mi)}} |
}} | }} | ||
|{{#if:{{{sqmi|}}}<!-- sqmi and no km2 --> | |{{#if:{{{sqmi|}}}<!-- sqmi and no km2 --> | ||
| − | |{{formatnum:{{{sqmi}}} | + | |{{formatnum:{{{sqmi}}}/sq mi ({{#expr: ({{formatnum:{{{sqmi}}}|R}})/2.58998811 round ({{precision|{{formatnum:{{{sqmi}}}|R}}}}+1)}}/km<sup>2</sup>)}} |
|{{#if:{{{m2|}}} | |{{#if:{{{m2|}}} | ||
|{{#if:{{{sqft|}}}<!-- sqft and m2 (and no sqmi and no km2) --> | |{{#if:{{{sqft|}}}<!-- sqft and m2 (and no sqmi and no km2) --> | ||
| − | |{{formatnum:{{{m2}}} | + | |{{formatnum:{{{m2}}}/m<sup>2</sup> ({{{sqft}}}/sq ft)}} |
| − | |{{formatnum:{{{m2}}} | + | |{{formatnum:{{{m2}}}/m<sup>2</sup> ({{#expr: ({{formatnum:{{{m2}}}|R}})/10.7639104 round ({{precision|{{formatnum:{{{m2}}}|R}}}}+1)}}/sq ft)}} |
}} | }} | ||
|{{#if:{{{sqft|}}}<!-- sqft and no m2 (and no sqmi and no km2 --> | |{{#if:{{{sqft|}}}<!-- sqft and no m2 (and no sqmi and no km2 --> | ||
| − | |{{formatnum:{{{sqft}}} | + | |{{formatnum:{{{sqft}}}/sq ft ({{#expr: ({{formatnum:{{{sqft}}}|R}})*10.7639104 round ({{precision|{{formatnum:{{{sqft}}}|R}}}}-0)}}/m<sup>2</sup>)}} |
}} | }} | ||
}} | }} | ||
}} | }} | ||
}}<noinclude>{{documentation}}</noinclude> | }}<noinclude>{{documentation}}</noinclude> | ||
Revision as of 23:53, 10 March 2020
This is a subtemplate of {{Infobox islands}}, and should not be used directly.
Usage
| Input | Output |
|---|---|
{{Infobox islands/density|km2=85}} |
85/km2 (Expression error: Unrecognized punctuation character "["./sq mi) |
{{Infobox islands/density|sqmi=220}} |
220/sq mi (Expression error: Unrecognized punctuation character "["./km2) |
{{Infobox islands/density|m2=25}} |
25/m2 (Expression error: Unrecognized punctuation character "["./sq ft) |
{{Infobox islands/density|sqft=2}} |
2/sq ft (Expression error: Unrecognized punctuation character "["./m2) |
{{Infobox islands/density|km2=85|sqmi=220}} |
85/km2 (220/sq mi) |
{{Infobox islands/density|m2=25|sqft=2}} |
25/m2 (2/sq ft) |
{{Infobox islands/density|km2=85|m2=25}} |
85/km2 (Expression error: Unrecognized punctuation character "["./sq mi) |
{{Infobox islands/density|sqmi=220|sqft=2}} |
220/sq mi (Expression error: Unrecognized punctuation character "["./km2) |
{{Infobox islands/density|m2=25|sqmi=220|sqft=2}} |
220/sq mi (Expression error: Unrecognized punctuation character "["./km2) |
{{Infobox islands/density|km2=85|sqmi=220|sqft=2}} |
85/km2 (220/sq mi) |
{{Infobox islands/density|km2=85|m2=25|sqft=2}} |
85/km2 (Expression error: Unrecognized punctuation character "["./sq mi) |
{{Infobox islands/density|km2=85|m2=25|sqmi=220}} |
85/km2 (220/sq mi) |
{{Infobox islands/density|km2=85|m2=25|sqmi=220|sqft=2}} |
85/km2 (220/sq mi) |
{{convert|85|/km2|abbr=on}}→ 85/km2 (220/sq mi){{convert|220|/sqmi|abbr=on}}→ 220/sq mi (85/km2)
Code
The code uses {{precision}} to determine the level of precision. The logic is to give preference to km2/sqmi over m2/sqft. If both km2 and sqmi are specified, then no conversion takes place. Similarly, if both m2 and sqft are specified (and km2/sqmi are not specified), then no conversion takes place.
See also
- {{convert}}
- {{Infobox islands/area}}
- {{Infobox islands/length}}
| The above documentation is transcluded from Template:Infobox islands/density/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |