Template:Cups
Appearance
Template:cups error - second parameter "US" or "metric" is required
Documentation
[edit]This template converts cups to mL. Metric conversion is required by MOS:CONVERSIONS.
There are two mandatory parameters:
- The first parameter is the number of cups.
- The second parameter is "US" or "metric", depending on which definition of "cup" is used.
- The optional third parameter is the upper end of a range, so {{cups|1|US|3}} is like doing {{convert|1|-|3|cups}} (if that actually worked)
- "disp=sqbr" is an optional named parameter that will cause the conversion to be surrounded in square brackets [] instead of round () so that it can be used in quotations, etc.
Notes:
- As described at Cup (unit), metric cups are exactly 250 mL. US cups could be either exactly 240 mL (as used for nutrition labels) or approximately 236.6 mL (1/16 a customary US gallon). The latter is probably what is meant in most recipes that don't specify, but the difference is negligible and many foods are hard to measure by volume precisely, so the 240 mL figure is always used for conversion, and the result is presented as approximate.
- Metric recipes are usually given in weight (grams) not volume (mL). Metric weight is preferred if this information is available, even if the US units show volume. This template does not convert from volume to weight, because the factor varies depending on the material.
- Other definitions of "cup" are rarely used, and are not supported by this template. Feel free to ping the author(s) if you feel they should be.
Test cases from Template:cups/tests:
US:
- 1 cup (~240 mL)
- 1/4 cup (~60 mL)
- 2 cups (~480 mL)
- 3+1/3 cups (~720 mL)
- 4⅓ Expression error: Unrecognized punctuation character "⅓". (~[convert: invalid number])
- 5.5 cups (~1,320 mL)
- 6-7 cups (~1,440–1,680 mL) (should be a range)
- 8 cups [~1,920 mL] (should show square brackets)
Metric:
- 1 cup (250 mL)
- 1/4 cup (63 mL)
- 2 cups (500 mL)
- 3+1/3 cups (750 mL)
- 4⅓ Expression error: Unrecognized punctuation character "⅓". (~[convert: invalid number])
- 5.5 cups (1,375 mL)
- 6-7 cups (1,500–1,750 mL) (should be a range)
- 8 cups [2,000 mL] (should show square brackets)
Intentional errors:
- notanumber Expression error: Unrecognized word "notanumber". (~[convert: invalid number])
- invalid 2nd parameter invalidvalue
- Template:cups error - second parameter "US" or "metric" is required