package pages import ( "fmt" "strings" . "recipe_book/pkg/db" ) func to_food_list(r Recipe) []Food { ret := make([]Food, len(r.Ingredients)) for i := range r.Ingredients { ret[i] = r.Ingredients[i].Food } return ret } templ RecipeDetail(recipe Recipe) {

{ recipe.Name }

Rename recipe

for _, i := range recipe.Ingredients { } {{ computed_food := recipe.ComputeFood() }}
Amount Ingredient Calories Carbs Protein Fat Sugar
{ i.DisplayAmount() } { i.Food.Name } { fmt.Sprint(int(i.Food.Cals * i.Quantity)) } { fmt.Sprint(int(i.Food.Carbs * i.Quantity)) } { fmt.Sprint(int(i.Food.Protein * i.Quantity)) } { fmt.Sprint(int(i.Food.Fat * i.Quantity)) } { fmt.Sprint(int(i.Food.Sugar * i.Quantity)) }
Total { fmt.Sprint(int(computed_food.Cals)) } { fmt.Sprint(int(computed_food.Carbs)) } { fmt.Sprint(int(computed_food.Protein)) } { fmt.Sprint(int(computed_food.Fat)) } { fmt.Sprint(int(computed_food.Sugar)) }
if recipe.Blurb != "" {

Blurb

for _, line := range strings.Split(recipe.Blurb, "\n") {

{ line }

} }

Instructions

    for _, instr := range recipe.Instructions {
  1. for _, line := range strings.Split(instr, "\n") {

    { line }

    }
  2. }
}