Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Conversions: Distinguish between Imperial/US units in volume (#4310)
Browse files Browse the repository at this point in the history
* Fix Imp/US Gallons.

* Fix tbsp/tsp/cups (imp/us)
  • Loading branch information
pjhampton authored and moollaza committed Jun 20, 2017
1 parent 5daa945 commit 7de983b
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 95 deletions.
54 changes: 28 additions & 26 deletions share/goodie/conversions/conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,21 @@ DDH.conversions = DDH.conversions || {};
{name: 'Gbar', factor:'100000000 bar'},

// CUSTOM SPEED UNITS
{name: 'knot', factor: '1.15078 mi/h'}
{name: 'knot', factor: '1.15078 mi/h'},

// CUSTOM VOLUME UNITS
{name: 'impgallon', factor: '4.54609 liters'},
{name: 'usgallon', factor: '3.7854 liters'},
{name: 'usfluidounce', factor: '0.0295735 liters'},
{name: 'impfluidounce', factor: '0.0284131 liters'},
{name: 'usquart', factor: '0.946353 liters'},
{name: 'impquart', factor: '1.13652 liters'},
{name: 'uscup', factor: '0.24 liters'},
{name: 'impcup', factor: '0.284131 liters'},
{name: 'ustbsp', factor: '0.0147868 liters'},
{name: 'imptbsp', factor: '0.0177582 liters'},
{name: 'ustsp', factor: '0.00492892 liters'},
{name: 'imptsp', factor: '0.00591939 liters'},
],

// custom units that are not supported by math.js
Expand Down Expand Up @@ -417,24 +431,6 @@ DDH.conversions = DDH.conversions || {};
],
defaults: ['meter', 'cm']
},
liquid_volume: {
name: "Liquid Volume",
units: [
{ symbol: 'minim', name: 'Minim' },
{ symbol: 'fluiddram', name: 'Fluid Dram' },
{ symbol: 'fluidounce', name: 'Fluid Ounce' },
{ symbol: 'gill', name: 'Gill' },
{ symbol: 'cup', name: 'Cup' },
{ symbol: 'pint', name: 'Pint' },
{ symbol: 'quart', name: 'Quart' },
{ symbol: 'gallon', name: 'Gallon' },
{ symbol: 'beerbarrel', name: 'Beerbarrel' },
{ symbol: 'oilbarrel', name: 'Oilbarrel' },
{ symbol: 'hogshead', name: 'Hogshead' },
{ symbol: 'drop', name: 'Drop' },
],
defaults: ['minim', 'fluiddram']
},
mass: {
name: "Mass",
units: [
Expand Down Expand Up @@ -545,17 +541,23 @@ DDH.conversions = DDH.conversions || {};
{ symbol: 'cc', name: 'Cubic Centimeter' },
{ symbol: 'cuin', name: 'Cubic Inch' },
{ symbol: 'cuft', name: 'Cubic Foot' },
{ symbol: 'cups', name: 'Cups' },
{ symbol: 'impcup', name: 'Cup (Imperial)' },
{ symbol: 'uscup', name: 'Cup (US Legal)' },
{ symbol: 'cuyd', name: 'Cubic Yard' },
{ symbol: 'pints', name: 'Pints' },
{ symbol: 'teaspoon', name: 'Teaspoon' },
{ symbol: 'tablespoon', name: 'Tablespoon' },
{ symbol: 'pints', name: 'Pint (US)' },
{ symbol: 'imptsp', name: 'Teaspoon (Imperial)' },
{ symbol: 'ustsp', name: 'Teaspoon (US)' },
{ symbol: 'imptbsp', name: 'Tablespoon (Imperial)' },
{ symbol: 'ustbsp', name: 'Tablespoon (US)' },
{ symbol: 'minim', name: 'Minim' },
{ symbol: 'fluiddram', name: 'Fluid Dram' },
{ symbol: 'fluidounce', name: 'Fluid Ounce' },
{ symbol: 'impfluidounce', name: 'Fluid Ounce (Imperial)' },
{ symbol: 'usfluidounce', name: 'Fluid Ounce (US)' },
{ symbol: 'gill', name: 'Gill' },
{ symbol: 'quart', name: 'Quart'},
{ symbol: 'gallon', name: 'Imperial Gallon'},
{ symbol: 'impquart', name: 'Quart (Imperial)'},
{ symbol: 'usquart', name: 'Quart (US)'},
{ symbol: 'usgallon', name: 'Gallon (US)'},
{ symbol: 'impgallon', name: 'Gallon (Imperial)'},
{ symbol: 'beerbarrel', name: 'Beerbarrel'},
{ symbol: 'oilbarrel', name: 'Oilbarrel'},
{ symbol: 'hogshead', name: 'Hogshead'},
Expand Down
144 changes: 136 additions & 8 deletions share/goodie/conversions/triggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1712,8 +1712,18 @@ unit: cuft
aliases:
- cup
- cups
- imp cup
- imp cups
- imperial cup
- imperial cups
type: volume
unit: cups
unit: impcup
---
aliases:
- us cup
- us cups
type: volume
unit: uscup
---
aliases:
- decalitre
Expand Down Expand Up @@ -1757,8 +1767,40 @@ type: volume
unit: fluiddram
---
aliases:
- fluidounce
- fluidounces
- us fluidounce
- us fluidounces
- us fluid ounce
- us fluid ounces
- us fluid oz
- us fluid ozs
- us floz
- us fl oz
- us fl. oz
- us fl. ozs
type: volume
unit: usfluidounce
---
aliases:
- imperial fluidounce
- imperial fluidounces
- imperial fluid ounce
- imperial fluid ounces
- imperial fluid oz
- imperial fluid ozs
- imperial floz
- imperial fl oz
- imperial fl. oz
- imperial fl. ozs
- imp fluidounce
- imp fluidounces
- imp fluid ounce
- imp fluid ounces
- imp fluid oz
- imp fluid ozs
- imp floz
- imp fl oz
- imp fl. oz
- imp fl. ozs
- fluid ounce
- fluid ounces
- fluid oz
Expand All @@ -1768,15 +1810,27 @@ aliases:
- fl. oz
- fl. ozs
type: volume
unit: fluidounce
unit: impfluidounce
---
aliases:
- gallon
- gallons
- gal
- gals
- imp gallon
- imp gallons
- imperial gallon
- imperial gallons
type: volume
unit: impgallon
---
aliases:
- us gal
- us gals
- us gallon
- us gallons
type: volume
unit: gallon
unit: usgallon
---
aliases:
- gill
Expand Down Expand Up @@ -1827,16 +1881,36 @@ aliases:
- pints
- pt
- pts
- us pint
- us pints
- us pt
- us pts
type: volume
unit: pints
---
aliases:
- us quart
- us quarts
- us qt
- us qts
type: volume
unit: usquart
---
aliases:
- quart
- quarts
- qt
- qts
- imperial quart
- imperial quarts
- imperial qt
- imperial qts
- imp quart
- imp quarts
- imp qt
- imp qts
type: volume
unit: quart
unit: impquart
---
aliases:
- tsp
Expand All @@ -1849,8 +1923,38 @@ aliases:
- teaspoons
- tea spoon
- tea spoons
- imperial tsp
- imperial tsp.
- imperial tsps
- imperial tsps.
- imperial teaspoon
- imperial teaspoons
- imperial tea spoon
- imperial tea spoons
- imp tsp
- imp tsp.
- imp tsps
- imp tsps.
- imp teaspoon
- imp teaspoons
- imp tea spoon
- imp tea spoons
type: volume
unit: imptsp
---
aliases:
- us tsp
- us tsp.
- us tsps
- us tsps.
- us tsp
- us tsp.
- us teaspoon
- us teaspoons
- us tea spoon
- us tea spoons
type: volume
unit: teaspoon
unit: ustsp
---
aliases:
- tbsp
Expand All @@ -1863,8 +1967,32 @@ aliases:
- tablespoons
- table spoon
- table spoons
- imperial tbsp
- imperial tbsp.
- imperial tbsps
- imperial tbsps.
- imperial tbsp
- imperial tbsp.
- imperial tablespoon
- imperial tablespoons
- imperial table spoon
- imperial table spoons
type: volume
unit: imptbsp
---
aliases:
- us tbsp
- us tbsp.
- us tbsps
- us tbsps.
- us tbsp
- us tbsp.
- us tablespoon
- us tablespoons
- us table spoon
- us table spoons
type: volume
unit: tablespoon
unit: ustbsp
---
aliases:
- hertz
Expand Down
Loading

0 comments on commit 7de983b

Please sign in to comment.