Difference between revisions of "Template:Infobox nutritional value/doc"

From blackwiki
Jump to navigation Jump to search
imported>Kihoiu
imported>Funandtrvl
m (update)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 +
<includeonly>{{intricate template}}</includeonly>
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
  
 
This is the {{tl|Nutritional value}} infobox template.
 
This is the {{tl|Nutritional value}} infobox template.
  
=== Brief usage ===
+
=== Basic usage ===
 
<pre style="overflow: auto">
 
<pre style="overflow: auto">
 
{{Nutritional value
 
{{Nutritional value
Line 17: Line 18:
  
 
=== Parameters ===
 
=== Parameters ===
* '''Required fields''': ''name'', ''kJ'', ''carbs'', ''fat'', ''protein''. You must state the units that are being used, except for kJ which is in kilojoules (1 Calorie  = 1 kcal = 4.2 kJ). E.g., '''fat = 3 g''', the units are usually expressed in grams (g).
+
* '''Required fields''': ''name'', ''kJ'', ''carbs'', ''fat'', ''protein''. You must state the units that are being used, except for kJ, which is in [[kilojoule]]s (1 Calorie  = 1 kcal = 4.2 kJ). The units are usually expressed in [[gram]]s (g), for example: {{para|fat|<var>3 g</var>}}.
 
** '''Note''': To specify energy in kcal rather than kJ, use ''kcal'' instead.
 
** '''Note''': To specify energy in kcal rather than kJ, use ''kcal'' instead.
 
* '''Optional fields''': ''image'', ''caption'', ''serving_size'', ''sugars'', ''lactose'', ''satfat'', ''transfat'', ''monofat'', ''polyfat'', ''omega3fat'', ''omega6fat'', ''fiber'', ''starch'', ''water'', ''alcohol'' and ''caffeine''. Again, you must state the units that are being used.
 
* '''Optional fields''': ''image'', ''caption'', ''serving_size'', ''sugars'', ''lactose'', ''satfat'', ''transfat'', ''monofat'', ''polyfat'', ''omega3fat'', ''omega6fat'', ''fiber'', ''starch'', ''water'', ''alcohol'' and ''caffeine''. Again, you must state the units that are being used.
Line 24: Line 25:
 
;The following optional variables are converted into percentages of RDA (taken as averages for males and females aged 25–50 years from the USDA 2000 recommendation):
 
;The following optional variables are converted into percentages of RDA (taken as averages for males and females aged 25–50 years from the USDA 2000 recommendation):
 
* '''Minerals''' (in mg) - ''calcium_mg'', ''iron_mg'', ''phosphorus_mg'', ''magnesium_mg'', ''manganese_mg'', ''sodium_mg'', ''potassium_mg'', ''zinc_mg''
 
* '''Minerals''' (in mg) - ''calcium_mg'', ''iron_mg'', ''phosphorus_mg'', ''magnesium_mg'', ''manganese_mg'', ''sodium_mg'', ''potassium_mg'', ''zinc_mg''
* '''Vitamins''' (in mg, μg, or international units) - ''vitA_ug'', ''vitA_iu'' (in IU), ''betacarotene_ug'' (subcategory of vitamin A!), ''thiamin_mg'' (Vit. B<sub>1</sub>), ''riboflavin_mg'' (Vit. B<sub>2</sub>), ''niacin_mg'' (Vit. B<sub>3</sub>), ''pantothenic_mg'' (pantothenic acid), ''vitB6_mg'', ''folate_ug'', ''vitB12_ug'', ''vitC_mg'', ''vitD_ug'', ''vitD_iu'' (in IU), ''vitE_mg'', ''vitK_ug''.
+
* '''Vitamins''' (in mg, μg, or international units) - ''vitA_ug'', ''vitA_iu'' (in IU), ''betacarotene_ug'' (subcategory of vitamin A!), ''thiamin_mg'' (Vit. B<sub>1</sub>), ''riboflavin_mg'' (Vit. B<sub>2</sub>), ''niacin_mg'' (Vit. B<sub>3</sub>), ''pantothenic_mg'' (pantothenic acid), ''vitB6_mg'', ''folate_ug'', ''vitB12_ug'', ''vitC_mg'', ''vitD_ug'', ''vitD_iu'' (in IU), ''vitE_mg'', ''vitK_ug''.
  
 
; Other optional variables and flags:
 
; Other optional variables and flags:
* '''Footnote''' - ''note'' a convenient way to indicate serving sizes or edible parts, e.g. ''1 banana is 100 to 150'' g or other information.
+
* '''note''' - a convenient way to indicate serving sizes or edible parts, e.g., ''1 banana is 100 to 150'' g or other information.
* '''Data source''' - ''source'' sets the source of the information used in the template.
+
* '''source''' - sets the data source of the information used in the template.
** '''USDA''' - ''source_usda'' a "yes" in this field will automatically set the source as the USDA database.
+
** '''source_usda''' - a "yes" in this field will automatically set the source as the USDA database.
* '''Suppression''' of RDA explanation - ''noRDA'' a value of "yes" will suppress the USDA recommenced daily value that is automatically assigned as part of several fields.
+
* '''noRDA''' - a value of "yes" will suppress the USDA recommenced daily value that is automatically assigned as part of several fields.
* '''Location''' - <code><nowiki>float = left</nowiki></code> will cause the table to appear on the left side of the article, <code><nowiki>float = center</nowiki></code> for centered, and <code><nowiki>float = none</nowiki></code> to place it on the left, but without wrapping text around it.  The default is <code><nowiki>float = right</nowiki></code>.
+
* '''float''' - <code><nowiki>|float=left</nowiki></code> will cause the table to appear on the left side of the article, <code><nowiki>|float=center</nowiki></code> for centered, and <code><nowiki>|float=none</nowiki></code> to place it on the left, but without wrapping text around it.  The default is <code><nowiki>|float=right</nowiki></code>.
  
 
; Additional notes:
 
; Additional notes:
Line 42: Line 43:
 
** vegetables, other low-calorie solid food, fruits: same, but for 400 g.
 
** vegetables, other low-calorie solid food, fruits: same, but for 400 g.
 
** other products: use an amount that one could reasonably eat on a daily basis.
 
** other products: use an amount that one could reasonably eat on a daily basis.
Nutritional values can be found e.g. in the [http://www.nal.usda.gov/fnic/foodcomp/search/ USDA National Nutrient Database]. Note that fibers are counted as carbohydrates.
+
Nutritional values can be found in the [http://www.nal.usda.gov/fnic/foodcomp/search/ USDA National Nutrient Database]. Note that fibers are counted as carbohydrates.
  
 
=== Full syntax ===
 
=== Full syntax ===
Line 53: Line 54:
 
| kJ              =  
 
| kJ              =  
 
| carbs          =  
 
| carbs          =  
 +
| starch          =
 +
| sugars          =
 +
| lactose        =
 +
| fiber          = <!-- or |fibre= -->
 
| fat            =  
 
| fat            =  
| protein        =
 
| sugars          =
 
| lactose        =
 
 
| satfat          =  
 
| satfat          =  
 
| transfat        =  
 
| transfat        =  
Line 63: Line 65:
 
| omega3fat      =  
 
| omega3fat      =  
 
| omega6fat      =  
 
| omega6fat      =  
| fiber          =
+
| protein        =  
| starch          =  
 
 
| water          =  
 
| water          =  
 
| alcohol        =  
 
| alcohol        =  
 
| caffeine        =  
 
| caffeine        =  
| opt1n          =
 
| opt1v          =
 
| opt4n          =
 
| opt4v          =
 
| calcium_mg      =
 
| iron_mg        =
 
| phosphorus_mg  =
 
| magnesium_mg    =
 
| manganese_mg    =
 
| sodium_mg      =
 
| potassium_mg    =
 
| zinc_mg        =
 
 
| vitA_ug        =  
 
| vitA_ug        =  
 
| vitA_iu        =  
 
| vitA_iu        =  
Line 96: Line 85:
 
| vitE_mg        =  
 
| vitE_mg        =  
 
| vitK_ug        =  
 
| vitK_ug        =  
 +
| calcium_mg      =
 +
| iron_mg        =
 +
| magnesium_mg    =
 +
| manganese_mg    =
 +
| phosphorus_mg  =
 +
| potassium_mg    =
 +
| sodium_mg      =
 +
| zinc_mg        =
 +
| opt1n          =
 +
| opt1v          =
 +
| opt2n          =
 +
| opt2v          =
 +
| opt3n          =
 +
| opt3v          =
 +
| opt4n          =
 +
| opt4v          =
 
| note            =  
 
| note            =  
 
| source          =  
 
| source          =  
Line 108: Line 113:
 
  | name = Foonuts
 
  | name = Foonuts
 
  | kJ = 2450
 
  | kJ = 2450
  | protein = 24 g
+
  | carbs = 22 g
 +
| starch = 8 g
 +
| sugars = 5 g
 +
| lactose = 1 g
 +
| fibre = 9 g
 
  | fat = 50 g
 
  | fat = 50 g
 
  | satfat = 7 g
 
  | satfat = 7 g
Line 116: Line 125:
 
  | omega3fat = 1 g
 
  | omega3fat = 1 g
 
  | omega6fat = 2 g
 
  | omega6fat = 2 g
  | carbs = 22 g
+
  | protein = 24 g
  | starch = 8 g
+
  | water = 5 g
| sugars = 5 g
+
  | alcohol = 1 g
  | lactose = 1 g
+
  | caffeine = 20 mg
  | fibre = 9 g
 
| sodium_mg = 40
 
| potassium_mg = 80
 
 
  | vitA_ug = 12
 
  | vitA_ug = 12
 
  | betacarotene_ug = 120
 
  | betacarotene_ug = 120
| vitC_mg = 20
 
 
  | thiamin_mg = 1
 
  | thiamin_mg = 1
 
  | riboflavin_mg = 2
 
  | riboflavin_mg = 2
 
  | niacin_mg = 0.5
 
  | niacin_mg = 0.5
 
  | pantothenic_mg = 0.1
 
  | pantothenic_mg = 0.1
 +
| vitB6_mg = 1
 
  | folate_ug = 1.5
 
  | folate_ug = 1.5
 +
| vitB12_ug = 0.5
 +
| vitC_mg = 20
 
  | vitD_ug = 10
 
  | vitD_ug = 10
 
  | vitE_mg = 5
 
  | vitE_mg = 5
 
  | vitK_ug = 10
 
  | vitK_ug = 10
 +
| calcium_mg = 200
 
  | iron_mg = 5
 
  | iron_mg = 5
 
  | magnesium_mg = 1.2
 
  | magnesium_mg = 1.2
 
  | manganese_mg = 1.2
 
  | manganese_mg = 1.2
 
  | phosphorus_mg = 50
 
  | phosphorus_mg = 50
 +
| potassium_mg = 80
 +
| sodium_mg = 40
 
  | zinc_mg = 0.4
 
  | zinc_mg = 0.4
  | calcium_mg = 200
+
  | note = Footnote text here
| vitB6_mg = 1
 
| vitB12_ug = 0.5
 
| water = 5 g
 
| alcohol = 1 g
 
| caffeine = 20 mg
 
 
  | source_usda = 1
 
  | source_usda = 1
| note  = Footnote text here
 
 
  | float =  
 
  | float =  
 
}}
 
}}
  
<pre style="width:33.3%;">
+
<pre style="width:33.3%; overflow: auto">
 
{{Nutritional value
 
{{Nutritional value
  | name         = Foonuts
+
  | name = Foonuts
  | kJ           = 2450
+
  | kJ = 2450
  | protein      = 24 g
+
  | carbs = 22 g
  | fat           = 50 g
+
| starch = 8 g
  | satfat       = 7 g
+
| sugars = 5 g
  | transfat     = 3 g
+
| lactose = 1 g
  | monofat       = 25 g
+
| fibre = 9 g
  | polyfat       = 16 g
+
  | fat = 50 g
  | omega3fat     = 1 g
+
  | satfat = 7 g
  | omega6fat     = 2 g
+
  | transfat = 3 g
  | carbs        = 22 g
+
  | monofat = 25 g
  | starch        = 8 g
+
  | polyfat = 16 g
| sugars        = 5 g
+
  | omega3fat = 1 g
  | lactose      = 1 g
+
  | omega6fat = 2 g
  | fiber        = 9 g
+
  | protein = 24 g
| sodium_mg    = 40
+
  | water = 5 g
| potassium_mg  = 80
+
  | alcohol = 1 g
  | vitA_ug       = 12
+
  | caffeine = 20 mg
 +
  | vitA_ug = 12
 
  | betacarotene_ug = 120
 
  | betacarotene_ug = 120
| vitC_mg      = 20
+
  | thiamin_mg = 1
  | thiamin_mg   = 1
 
 
  | riboflavin_mg = 2
 
  | riboflavin_mg = 2
  | niacin_mg     = 0.5
+
  | niacin_mg = 0.5
 
  | pantothenic_mg = 0.1
 
  | pantothenic_mg = 0.1
  | folate_ug     = 1.5
+
| vitB6_mg = 1
  | vitD_ug       = 10
+
  | folate_ug = 1.5
  | vitE_mg       = 5
+
| vitB12_ug = 0.5
  | vitK_ug       = 10
+
| vitC_mg = 20
  | iron_mg       = 5
+
  | vitD_ug = 10
  | magnesium_mg = 10
+
  | vitE_mg = 5
  | manganese_mg = 1.2
+
  | vitK_ug = 10
 +
| calcium_mg = 200
 +
  | iron_mg = 5
 +
  | magnesium_mg = 1.2
 +
  | manganese_mg = 1.2
 
  | phosphorus_mg = 50
 
  | phosphorus_mg = 50
  | zinc_mg      = 0.4
+
  | potassium_mg = 80
  | calcium_mg    = 200
+
  | sodium_mg = 40
  | vitB6_mg      = 1
+
  | zinc_mg = 0.4
| vitB12_ug    = 0.5
+
  | note = Footnote text here
  | water        = 5 g
+
  | source_usda = 1
| alcohol      = 1 g
+
  | float =  
| caffeine      = 20 mg
 
| tryptophan    = 0.010 g
 
  | source_usda   = 1
 
| note          = Footnote text here
 
  | float         =  
 
 
}}
 
}}
 
</pre>
 
</pre>
Line 200: Line 204:
 
will generate →
 
will generate →
 
{{-}}
 
{{-}}
 
=== Template editing ===
 
This is a complex template that is used by over 150 articles as of October 2008. Breaking this template will cause problems in all those articles, so please use {{tl|Nutritional value/sandbox}} for experimenting with the layout.
 
 
In the HTML version: don't put line breaks into the template around the <nowiki>{{#if:...}}</nowiki> parser functions, because they will end up as line breaks above the table.
 
  
 
=== Translations ===
 
=== Translations ===

Revision as of 00:18, 7 February 2011


This is the {{Nutritional value}} infobox template.

Basic usage

{{Nutritional value
| name    =
| kJ      =
| carbs   =
| fat     =
| protein =
| note    =
}}

Parameters

  • Required fields: name, kJ, carbs, fat, protein. You must state the units that are being used, except for kJ, which is in kilojoules (1 Calorie = 1 kcal = 4.2 kJ). The units are usually expressed in grams (g), for example: |fat=3 g.
    • Note: To specify energy in kcal rather than kJ, use kcal instead.
  • Optional fields: image, caption, serving_size, sugars, lactose, satfat, transfat, monofat, polyfat, omega3fat, omega6fat, fiber, starch, water, alcohol and caffeine. Again, you must state the units that are being used.
  • Contributor defined fields: Additional fields can be added using the opt1n and opt1v fields, where n is for name and v is for value. Up to four optional fields are supported, opt1n & opt1v up to opt4n & opt4v.
The following optional variables are converted into percentages of RDA (taken as averages for males and females aged 25–50 years from the USDA 2000 recommendation)
  • Minerals (in mg) - calcium_mg, iron_mg, phosphorus_mg, magnesium_mg, manganese_mg, sodium_mg, potassium_mg, zinc_mg
  • Vitamins (in mg, μg, or international units) - vitA_ug, vitA_iu (in IU), betacarotene_ug (subcategory of vitamin A!), thiamin_mg (Vit. B1), riboflavin_mg (Vit. B2), niacin_mg (Vit. B3), pantothenic_mg (pantothenic acid), vitB6_mg, folate_ug, vitB12_ug, vitC_mg, vitD_ug, vitD_iu (in IU), vitE_mg, vitK_ug.
Other optional variables and flags
  • note - a convenient way to indicate serving sizes or edible parts, e.g., 1 banana is 100 to 150 g or other information.
  • source - sets the data source of the information used in the template.
    • source_usda - a "yes" in this field will automatically set the source as the USDA database.
  • noRDA - a value of "yes" will suppress the USDA recommenced daily value that is automatically assigned as part of several fields.
  • float - |float=left will cause the table to appear on the left side of the article, |float=center for centered, and |float=none to place it on the left, but without wrapping text around it. The default is |float=right.
Additional notes
  • According to convention, there should be a space between the number and the unit: "14 g" and not "14g".
  • Don't specify numbers in too many decimals. Food is often very variable; the USDA tables provide a standard deviation as an indication for how accurate the number is. If it says "1.2345 g" with a standard deviation of 0.08 g, then 1.2 g is the highest accuracy worth mentioning.
  • Splitting up components that are present in trace amounts is not very meaningful (e.g. 1.5 g fats of which 0.5 g unsaturated).
  • The author of the template recommends to include only vitamins and minerals for which this product is considered to be a major source, in order to prevent clogging up the article with a huge table. As a guideline:
    • staple foods: an amount that provides 10,000 kJ should provide well over 100% of the RDI.
    • meats and such: same, but for 4,000 kJ.
    • vegetables, other low-calorie solid food, fruits: same, but for 400 g.
    • other products: use an amount that one could reasonably eat on a daily basis.

Nutritional values can be found in the USDA National Nutrient Database. Note that fibers are counted as carbohydrates.

Full syntax

{{Nutritional value
| name            = 
| image           =
| caption         =
| serving_size    =
| kJ              = 
| carbs           = 
| starch          = 
| sugars          =
| lactose         =
| fiber           = <!-- or |fibre= -->
| fat             = 
| satfat          = 
| transfat        = 
| monofat         = 
| polyfat         = 
| omega3fat       = 
| omega6fat       = 
| protein         = 
| water           = 
| alcohol         = 
| caffeine        = 
| vitA_ug         = 
| vitA_iu         = 
| betacarotene_ug = 
| lutein_ug       =
| thiamin_mg      = 
| riboflavin_mg   = 
| niacin_mg       = 
| pantothenic_mg  = 
| vitB6_mg        = 
| folate_ug       = 
| vitB12_ug       = 
| vitC_mg         = 
| vitD_ug         = 
| vitD_iu         = 
| vitE_mg         = 
| vitK_ug         = 
| calcium_mg      = 
| iron_mg         = 
| magnesium_mg    = 
| manganese_mg    = 
| phosphorus_mg   =
| potassium_mg    = 
| sodium_mg       =
| zinc_mg         = 
| opt1n           = 
| opt1v           = 
| opt2n           = 
| opt2v           = 
| opt3n           = 
| opt3v           = 
| opt4n           = 
| opt4v           = 
| note            = 
| source          = 
| source_usda     = 
| noRDA           = 
| float           = 
}}

Examples

Template:Nutritional value

{{Nutritional value
 | name = Foonuts
 | kJ = 2450
 | carbs = 22 g
 | starch = 8 g
 | sugars = 5 g
 | lactose = 1 g
 | fibre = 9 g
 | fat = 50 g
 | satfat = 7 g
 | transfat = 3 g
 | monofat = 25 g
 | polyfat = 16 g
 | omega3fat = 1 g
 | omega6fat = 2 g
 | protein = 24 g
 | water = 5 g
 | alcohol = 1 g
 | caffeine = 20 mg
 | vitA_ug = 12
 | betacarotene_ug = 120
 | thiamin_mg = 1
 | riboflavin_mg = 2
 | niacin_mg = 0.5
 | pantothenic_mg = 0.1
 | vitB6_mg = 1
 | folate_ug = 1.5
 | vitB12_ug = 0.5
 | vitC_mg = 20
 | vitD_ug = 10
 | vitE_mg = 5
 | vitK_ug = 10
 | calcium_mg = 200
 | iron_mg = 5
 | magnesium_mg = 1.2
 | manganese_mg = 1.2
 | phosphorus_mg = 50
 | potassium_mg = 80
 | sodium_mg = 40
 | zinc_mg = 0.4
 | note = Footnote text here
 | source_usda = 1
 | float = 
}}

will generate →

Translations

If you translate this template for use in other language wikipedias, you could consider keeping the English variable names, so that you can simply copy/paste existing tables from English to your language (and back). Or you could make two versions, one using native-language variable names, and the other using the English names.