summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 96fac3a9fb07e83eedc0331995dd1fa150d194dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use recipe_parser::Recipe;

fn main() {
    let recipe = Recipe::parse(
        "Combine {bulghur wheat, 1 cup} and {boiling water, 1 cup, for wheat}. Set aside for 20 minutes. Put {whole-meal flour, 2 cups}, {salt, 2 tsp}, and {yeast, 2 tbsp} in a bowl and stir together. Add {cold water, 1 cup} and {golden syrup, 1 tbsp}, immediately followed by {boiling water, 1 cup}. Stir to a smooth paste and stand for 2 to 3 minutes. Mix in the {egg, 1} and {high-grade flour, 3 cups}, adding the last cup of flour slowly (more or less than the cup may be needed to give a very thick batter, which is not quite as stiff as dough). Mix for 3 to 4 minutes. Cover and put in a warm place for 15 minutes. Stir well and pour into two 22cm greased loaf tins. Put in a warm place until the dough doubles in volume. Bake at 200°C for 35 minutes or until the loaf sounds hollow when tapped on the bottom. If loaf is browning too quickly, cover with foil.",
    );
    for i in recipe.ingredients {
        let unit = match i.unit {
            Some(unit) => format!("{} of ", unit),
            None => String::new(),
        };
        let addendum = match i.addendum {
            Some(addendum) => format!(" ({})", addendum),
            None => String::new(),
        };
        println!("- {} {}{}{}", i.quantity, unit, i.name, addendum);
    }
    println!();
    for paragraph in recipe.process {
        println!("{}\n", paragraph);
    }
}