Пример #1
0
#!/usr/bin/env python

from latex_python.recipes.Recipe import Recipe
from latex_python.recipes.Quantities import Cup, Tablespoon, Teaspoon

recipe = Recipe('Crepes')

recipe.doubleRecipe()
recipe.tripleRecipe()

recipe.ingredient('Flour', Cup(1), 'in order of preference: whole wheat pastry, white whole wheat, bread')
recipe.ingredient('Eggs', 3)
recipe.ingredient('Milk', Cup(1.25), 'mix in some buttermilk or kefir for flavor')
recipe.ingredient('Canola oil', Tablespoon(1))
recipe.ingredient('Salt', Teaspoon(0.5))
recipe.ingredient('Sugar', Teaspoon(1))

recipe.description('French style crepes, which are very good with either sweet or savory ingredients.')

# note: should covert 1/3 to \nicefrac{1}{3}
recipe.addInstruction('''
Mix all the ingredients thouroughly with a hand mixer (preferred), or in a blender
until you get a uniform batter with the consistency of cream. After mixing,
let it sit about 10 minutes and add milk as necessary (if it thickens).
Pour about 1/3 cup batter in an evenly-heated flat pan, after a small amount of
butter has been melted in it.

Cook the first side until it smells like bread,
and the second side only for about 10 seconds.
''')
Пример #2
0
def generate():
    r = Recipe('Cuban Beans and Rice')

    r.ingredient('olive oil', Tablespoon(3))
    r.ingredient('onion', 1, 'peeled and chopped')
    r.ingredient('carrot', 1, 'in 1/4-inch slices')
    r.ingredient('garlic', 4, 'minced')
    r.ingredient('short grain brown rice', Cup(0.75))

    r.ingredientGroupDivider()
    r.ingredient('water', Cup(3), 'about 1/3 less if using white rice')
    r.ingredient('dry black beans', Cup(1), 'washed and soaked for 2+ hours')

    r.ingredient('salt', Teaspoon(1))
    r.ingredient('black pepper', Teaspoon(0.25))
    r.ingredient('ground cumin', Teaspoon(1), 'or more to taste')
    r.ingredient('cayenne', Teaspoon(0.25))

    # option 3 (Danni's)
    r.ingredient('bay leaves', 1)
    r.ingredient('coriander', Teaspoon(0.5))
    r.ingredient('\\emph{smoked} red pepper flakes', Teaspoon(1))
    r.ingredient('cilantro', Cup(0.25), 'chopped, including stems')

    r.ingredientGroupDivider()
    r.ingredient('red bell pepper', 0.5, 'cut into chunks')
    r.ingredient('lime (juice of)', 1)

    r.doubleRecipe()


    r.description('Inspired by the Swiss pressure cooking cookbook, revised by Danni')

    r.addInstruction('''
        Heat olive oil over medium high heat in pressure cooker.
        Add onion, garlic, and carrot if you are including one. Sautée until onion softens.
        Add rice over high heat, stirring often, until lightly golden.

        Add water and soaked, drained beans. Stir in salt, pepper, herbs, and spices.
        Close lid and bring pressure to first ring over high heat.
        Cook for 22 minutes on the first ring.

        Use the natural release method.
        When the pressure releases, add the red bell pepper chunks and the lime juice.
    ''')
    r.addInstruction('Serve with plain yogurt.')

    r.yieldPerBatch(4, 'servings')

    return r.generate('cubanBeansAndRice.pdf')
Пример #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from latex_python.recipes.Recipe import Recipe, Ingredient
from latex_python.recipes.Quantities import Quart, Cup, Tablespoon, Teaspoon, FluidOunce, Bunch, Pound, Ounce

from os.path import splitext

# title of the dish
recipe = Recipe('Title')

# Description shows up near the title.
recipe.description('An enticing sentence that makes you want to cook this.')

# ingredient name, quantity, prep/notes
#
# Quantities:
# use Cup((2,3)) to indicate a range
# use quantity == None for things like salt (i.e. to taste)
#
# Descriptions:
# Quantities can have a descriptive modifier like 'large' or 'overflowing'.
# (there is no restriction on what can be identified)
# EX:   recipe.ingredient('brown rice', Cup(1.5, 'overflowing'))
#       recipe.ingredient('kale', Bunch(1, 'large'), 'chopped')
recipe.ingredient('apples', 3, 'galas, preferably')
recipe.ingredient('bosc pears', 2)

recipe.ingredientSpace() # to add white space
recipe.ingredient('salt', None, 'to taste')