Difference between revisions of "Template:BScvt"

From blackwiki
Jump to navigation Jump to search
imported>Jc86035
m
imported>KrakatoaKatie
m (Protected "Template:BScvt": Highly visible template ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite)))
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<includeonly>{| cellspacing="0" cellpadding="0" style="font-size:80%; text-align:{{{align|right}}}; float:{{{align|right}}} color:inherit; background-color:transparent; margin-top:-2px; margin-bottom:-2px; display:inline-table;vertical-align:bottom;"
+
<includeonly>{{#invoke:Routemap|BScvt}}</includeonly><noinclude>
| style="line-height:0.9em; padding:0; text-align:inherit;" | {{{1}}} {{#switch: {{{in}}}
 
  | ch={{#if:{{{2|}}}|m&nbsp;|ch&nbsp;}}
 
  | m={{#if:{{{2|}}}|yd&nbsp;|m&nbsp;}}
 
  | yd={{#if:{{{2|}}}|m&nbsp;|yd&nbsp;}}
 
  | ft={{#if:{{{2|}}}|m&nbsp;|ft&nbsp;}}
 
  | #default={{#if:{{{2|}}}|km&nbsp;|mi&nbsp;}}
 
  }}
 
|-
 
| style="line-height:0.9em; padding:0; font-style:{{{alt|normal}}}; text-align:inherit; {{#if:{{{line|}}}|border-top:1px solid gray; line-height:125%;|}}" | {{#if:{{{2|}}}|{{#expr:{{{1}}}*{{#switch: {{{in}}}
 
  | ch=0.04971
 
  | m=0.9144
 
  | yd=1.0936
 
  | ft=3.2808
 
  | #default=0.621371
 
  }}
 
round{{#ifexpr:{{Str find|{{{1}}}|.}}>0|{{#expr:{{strlen short|{{{1}}}}}-{{Str find|{{{1}}}|.}}}}|0}}}} {{#switch: {{{in}}}
 
  | ch=ch&nbsp;
 
  | m=m&nbsp;
 
  | yd=yd&nbsp;
 
  | ft=ft&nbsp;
 
  | #default=mi&nbsp;
 
  }}
 
|{{#expr:{{{1}}}*{{#switch: {{{in}}}
 
  | ch=20.1168
 
  | m=1.0936
 
  | yd=0.9144
 
  | ft=0.3048
 
  | #default=1.609344
 
  }}
 
round{{#ifexpr:{{Str find|{{{1}}}|.}}>0|{{#expr:{{strlen short|{{{1}}}}}-{{Str find|{{{1}}}|.}}}}|0}}}} {{#switch: {{{in}}}
 
  | ch|yd|ft=m&nbsp;
 
  | m=yd&nbsp;
 
  | #default=km&nbsp;
 
  }}
 
}}
 
|}</includeonly><noinclude>
 
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 15:33, 7 November 2016

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

Usage

This template is a simplified version of {{Convert}}. It displays a distance as two lines of text. The template takes the input (in Imperial units) and calculates the metric equivalent.

  • Inserting the optional second parameter (any character) reverses the units.
  • Decimal values are supported.
  • The template automatically adds the units after the values.

The text is right-aligned, but can be changed to left- by applying the parameter "align=left".

The alternate units can be changed to italic by applying the parameter "alt=italic".

A dividing line can be added by applying the parameter “|line=anything ”.

Units

The default units are miles for input and kilometres as output.

  • Adding the named parameter |in= (for input) will allow alternate input units:
in= Units Converts to
mi;ch miles; chains kilometres
yd yards metres
ft feet
ch chains
m metres yards
  • Whitespace for mi;ch (in both the distance and the units) is allowed but not necessary.

Examples

Result Input
0 mi
0 km
{{BScvt|0}}
1.50 km
0.93 mi
{{BScvt|1.50|x}}
16.3 mi
26.2 km
{{BScvt|16.3|align=left}}
100.0 mi
160.9 km
{{BScvt|100.0|alt=italic}}
150 mi
241 km
{{BScvt|150|line=-}}
56 mi 12 ch
90.36 km
{{BScvt|56; 12|in=mi; ch}}
125 yd
114 m
{{BScvt|125|in=yd}}
150 m
164 yd
{{BScvt|150|in=m}}
50 ch
1010 m
{{BScvt|50|in=ch}}
250 m
12.4 ch
{{BScvt|250|in=ch|x}}

See also