Difference between revisions of "Template:Endurance/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Frietjes
imported>Frietjes
(temporarily save old version)
 
Line 1: Line 1:
<includeonly><!-- start tracking -->{{#ifeq:{{{ohp}}}|y||{{#if:{{{sep|}}}|{{endurance/m}}|{{endurance/knot}}}}}}<!-- end tracking -->{{convert|{{{1|}}}|{{{2|}}}|{{{3|}}}|sp={{{sp|}}}|abbr={{{abbr|out}}}|disp=x| {{{sep|@}}} {{formatnum:{{{4|}}}}} {{convert|0|{{{5|}}}|sp={{{sp|}}}|abbr={{{abbr|off}}}|disp=unit}}{{#if:{{{7|}}}|, {{{7}}}}} (| {{{sep|@}}} {{convert|{{{4|}}}|{{{5|}}}|{{{6|}}}|sp={{{sp|}}}|abbr=on|disp=out}})}}</includeonly>
+
<includeonly>{{#ifeq:{{{ohp}}}|y||{{#if:{{{sep|}}}|{{endurance/m}}|{{endurance/knot}}}}}}{{endurance/in|{{{1}}}|{{{2}}}|{{abbr|}}}|{{{4}}}|{{{5}}}|sep={{{sep|@}}}|r={{#ifeq:{{lc:{{{sp}}}}}|us|er|re}}}}{{#if:{{{7|}}}|, {{{7}}}|}}<!--
 +
{{#if:{{{refname|}}}|<ref name={{{refname}}}{{#if:{{{ref|}}}|>{{{ref}}}</ref>|/>}}}}
 +
--> ({{#switch:{{{3}}} {{{6}}}
 +
|km mi km/h mph={{endurance/two|{{{1}}}|{{{2}}}|km|mi|{{{4}}}|{{{5}}}|km/h|mph|sep={{{sep|@}}}}}
 +
|nmi mi kn mph ={{endurance/two|{{{1}}}|{{{2}}}|nmi|mi|{{{4}}}|{{{5}}}|kn|mph|sep={{{sep|@}}}}}
 +
|nmi km kn km/h={{endurance/two|{{{1}}}|{{{2}}}|nmi|km|{{{4}}}|{{{5}}}|kn|km/h|sep={{{sep|@}}}}}
 +
|mi km mph km/h={{endurance/two|{{{1}}}|{{{2}}}|mi|km|{{{4}}}|{{{5}}}|mph|km/h|sep={{{sep|@}}}}}
 +
|mi nmi mph kn ={{endurance/two|{{{1}}}|{{{2}}}|mi|nmi|{{{4}}}|{{{5}}}|mph|kn|sep={{{sep|@}}}}}
 +
|km nmi km/h kn={{endurance/two|{{{1}}}|{{{2}}}|km|nmi|{{{4}}}|{{{5}}}|km/h|kn|sep={{{sep|@}}}}}
 +
|{{endurance/out|{{{1}}}|{{{2}}}|{{{3}}}|{{{4}}}|{{{5}}}|{{{6}}}|sep={{{sep|@}}}}}
 +
}})</includeonly><noinclude><!-- Add categories to the /doc subpage, not here! -->
 +
{{documentation}}  
 +
</noinclude>

Latest revision as of 15:14, 31 December 2013

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

This template is designed to provide easier-to-read unit conversions for endurance figures, which are often given as distance @ speed, by using Template:Convert for the unit conversions.

Usage

  • {{endurance|distance|from_unit1|to_unit1|speed|from_unit2|to_unit2|[optional note]}}

where:

Optional parameters

There are optional parameters that control the appearance of the output:

  • abbr: when abbr is set to "on", the input units are abbreviated, which can be useful within infoboxes; the output units are already abbreviated
  • sp: when sp is set to "us", the American spelling of metric units, i.e. meter vs. metre

(Both of these parameters behave the same as they do in Template:Convert

  • sep: a value in the parameter sep overrides the default @ symbol

Units supported

The template currently supports the following units (in any combination or conversion direction):

Please add requests for additional units to the talk page

Examples

  • {{endurance|450|nmi|km|5|knots|km/h}} → 450 nautical miles @ 5 knots (830 km @ 9.3 km/h)
  • {{endurance|100|km|nmi|35|km/h|knots}} → 100 kilometres @ 35 kilometres per hour (54 nmi @ 19 kn)
Optional note
  • {{endurance|450|nmi|km|5|knots|km/h|submerged}} → 450 nautical miles @ 5 knots, submerged (830 km @ 9.3 km/h)
Abbreviated output
  • {{endurance|450|nmi|km|5|knots|km/h|abbr=on}} → 450 nmi @ 5 kn (830 km @ 9.3 km/h)
US spelling of metric units
  • {{endurance|100|km|nmi|35|km/h|knots|sp=us}} → 100 kilometers @ 35 kilometers per hour (54 nmi @ 19 kn)
Optional separator
  • {{endurance|2100|nmi|km|16|knots|km/h|sep=at}} → 2,100 nautical miles at 16 knots (3,900 km at 30 km/h)

See also