General Disclaimer:   (HV) (DC) injury or death hazard,   use at your own risk,   may void warranty.

Difference between revisions of "Template:Mpg"

From My wiki
Jump to navigation Jump to search
m
(update from W:Template:Mpg)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly>{{{1}}} mpg ({{#expr: ( 1 / {{{1}}} * 100 ) * 3.78541178 / 1.609344 round 2}} L/100 km)</includeonly><noinclude>
+
<includeonly>{{{1}}}&nbsp;{{#switch:{{{lk|}}}|on=[[W:Miles per gallon|mpg&ndash;U.S.]]|=mpg&ndash;U.S.}} ({{#expr: ( 1 / {{{1}}} * 100 ) * 3.78541178 / 1.609344 round 2}}&nbsp;{{#switch:{{{lk|}}}|on=[[W:L/100 km|L/100&nbsp;km]]|=L/100&nbsp;km}}&nbsp;/&nbsp;{{#expr:{{{1}}}* 1.20105680 round 1}}&nbsp;{{#switch:{{{lk|}}}|on=[[W:Imperial MPG|mpg&ndash;imp]]|=mpg&ndash;imp}})</includeonly><noinclude>
Template to convert fuel mileage form US mpg into Liters per 100km and display both
+
 
:<nowiki> {{{1}}} mpg {{#expr: ( 1 / {{{1}}} * 100 ) * 3.78541178 / 1.609344 round 2}} L/100 km)</nowiki>
+
Template to convert fuel mileage from US mpg into Liters per 100&nbsp;km and imperial mpg and display all three via:
 +
:<nowiki> {{{1}}}&nbsp;mpg&ndash;U.S. {{#expr: ( 1 / {{{1}}} * 100 ) * 3.78541178 / 1.609344 round 2}}&nbsp;L/100&nbsp;km&nbsp;/&nbsp;{{{1}}}* 1.20105680 round 1}}&nbsp;mpg&ndash;imp)</nowiki>
 
Useage:
 
Useage:
*<nowiki>{{45|mpg}}</nowiki> results in 45 mpg (5.23 L/100 km)
+
*<nowiki>{{mpg|45}}</nowiki> results in {{mpg|45}}
 +
*<nowiki>{{mpg|45|lk=on}}</nowiki> results in {{mpg|45|lk=on}}
 +
 
 +
Options:
 +
* Make units [[W:Wikipedia:Manual of Style (links)|wikilinked]] by attaching <code><nowiki>|lk=on</nowiki></code>.
 +
*:The [[W:WP:MOS|manual of style]] suggests that you only link the first instance.
 +
 
 
See also:
 
See also:
 +
* [[Template:Mpg (Imperial)]] - For Imperial (UK) gallons version
 
* [[Template:L100km]]
 
* [[Template:L100km]]
 +
* [[W:Template:Convert]]
 +
 
</noinclude>
 
</noinclude>

Latest revision as of 11:33, 15 January 2008


Template to convert fuel mileage from US mpg into Liters per 100 km and imperial mpg and display all three via:

{{{1}}} mpg–U.S. {{#expr: ( 1 / {{{1}}} * 100 ) * 3.78541178 / 1.609344 round 2}} L/100 km / {{{1}}}* 1.20105680 round 1}} mpg–imp)

Useage:

  • {{mpg|45}} results in 45 mpg–U.S. (5.23 L/100 km / 54 mpg–imp)
  • {{mpg|45|lk=on}} results in 45 mpg–U.S. (5.23 L/100 km / 54 mpg–imp)

Options:

See also: