Counting calories would involve combining information about ingredients with information about recipes. The combining might or might not include special knowledge of cooking.
Favorite Broccoli Recipes asks how we might collaboratively edit a recipe. Here we address how we might coax wiki to compute calories in a collaboration compatible way.
We've already developed a calorie counter of sorts but this one estimates calorie burn. The plugin understands daily metabolism and expects to find a table of metabolic equivalents for many activities. The plugin has special knowledge which makes it hard to adapt to cooking.
We've also developed a more versatile plugin that does simple calculations while looking up unit conversion factors as it goes. This can be adapted to calorie counting but its presentation isn't specific to cooking or anything else.
We'll try working out a recipe for something simple like chocolate dipped celery sticks. First we specify the caloric content of the raw ingredients.
4 (calories) per (celery stalks) 50 (calories) per (oz chocolate)
These numbers could come from other sites, possibly many sites. The numbers flow from item to item, page to page. Now we will sum the calories based on the proportions in our recipe.
10 (celery stalks) SUM (calories) 0.5 (oz chocolate) SUM Appetizer (calories)
This plugin doesn't know we want to sum calories so we sum a little bit at a time specifying that we're looking for measurements in calories.
We can continue computing the calories in our whole meal and convert that to the pounds we'll add to our waist.
3500 Fat (calories) per (lbs)
Here we recall the result for our appetizer and add the rest of our meal. This time we sum to pounds which works because we know the conversion factor.
Appetizer (calories) 600 Dessert (calories) SUM Meal Equivalent (lbs)
The Method plugin was designed for documenting the method of computation as much as the result. When spread across many pages, each can be forked individually and tried with different assumptions.
We've yet to make our update logic as interactive as we intend. See Hacking Wiki's Methods for how we work.