Template:Infobox nutritional value/doc

This is the infobox nutritional value template.

Basic usage


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: 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, cholesterol, 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, copper_mg, iron_mg, phosphorus_mg, magnesium_mg, manganese_mg, selenium_ug, sodium_mg, potassium_mg, zinc_mg
 * Vitamins (in mg, μg, or international units) - vitA_ug, vitA_iu (in IU), vitA_asbeta_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, choline_mg, vitC_mg, vitD_ug, vitD_iu (in IU), vitE_mg, vitE_iu, 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 1 in this field will automatically set the source as the USDA database.
 * noRDA - optional suppression of RDA message: noRDA=1
 * float - left will cause the table to appear on the left side of the article, center for centered, and none to place it on the left, but without wrapping text around it. The default is right.

Nutritional values can be found in the USDA National Nutrient Database. Note that fibers are counted as carbohydrates. Note also that the calculated energy value given in the USDA database sometimes includes 4 kcal per gram of fibre, which is not really correct, and it would be better for Wikipedia articles to exclude the fibre from the energy value. (The USDA documentation says, "For multi-ingredient processed foods, kilocalorie values (source codes 8 or 9; ...) generally reflect industry practices (as permitted by NLEA) of calculating kilocalories as 4, 4, or 9 kilocalories per gram of protein, carbohydrate, and fat, respectively, or as 4, 4, or 9 kilocalories per gram of protein, carbohydrate minus insoluble fiber, and fat. The latter method is often used for high-fiber foods.")
 * Additional notes:
 * According to convention, there should be a non-breaking space between the number and the unit: "14&amp;nbsp;g" (which displays as "14 g") and not "14g".
 * Don't specify numbers in too many decimals.
 * 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).
 * Only vitamins and minerals for which this product is considered to be a good source should be included, in order to prevent clogging up the article with a huge table.

Full syntax


Examples


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.

TemplateData
{	"description": "A template for recording the nutritional value of foods", "params": { "name": { "description": "The name of the food", "required": true },		"kJ": { "suggested": true },		"carbs": { "description": "Total carbohydrates per 100 grams of food. State the unit being used (usually g for grams).", "required": true },		"fat": { "description": "Total fat per 100 grams of food. State the unit being used (usually g for grams).", "required": true },		"protein": { "description": "Total protein per 100 grams of food. State the unit being used (usually g for grams).", "required": true },		"note": { "description": "Any explanatory notes, e.g., which parts of the vegetable are edible" }	},	"format": "block" }