get_recipe_page :: (req: Request) -> string { id := table_find_pointer(*req.query, "id"); if !id then return "

Error: invalid recipe id

"; curRecipe : Recipe; for state.recipes if it.id == id.* curRecipe = it; if curRecipe.id == "" then return "

Can't find recipe!

"; builder : String_Builder; add_navbar(*builder); print_to_builder(*builder, recipeHero, curRecipe.image); print_to_builder(*builder, "
"); print_to_builder(*builder, recipeHeroCard, curRecipe.id, curRecipe.category, curRecipe.name, curRecipe.duration, curRecipe.duration); print_to_builder(*builder, "
"); print_to_builder(*builder, "
"); add_ingredients(curRecipe, *builder); add_steps(curRecipe, *builder); print_to_builder(*builder, "
"); return builder_to_string(*builder); } add_ingredients :: (recipe: Recipe, builder: *String_Builder) { print_to_builder(builder, "
"); print_to_builder(builder, "
Ingredients
"); ingredientHtml : string = #string DONE
%
%
DONE slotHtml : string = #string DONE
Component slot
%
1
DONE for recipe.components { b : String_Builder; if !it.isSlot { print_to_builder(builder, ingredientHtml, it.ingredient.name, it.ingredient.amount); } else { for t : it.slot.tags { print_to_builder(*b, "[%] ", t); } print_to_builder(builder, slotHtml, builder_to_string(*b)); } } print_to_builder(builder, "
"); } add_steps :: (recipe: Recipe, builder: *String_Builder) { stepHtml : string = #string DONE
%
%
DONE print_to_builder(builder, "
"); print_to_builder(builder, "
Steps
"); for it, i : recipe.steps { print_to_builder(builder, stepHtml, i+1, it); } print_to_builder(builder, "
"); } recipeHeroCard : string = #string DONE
% • % • HIGH PROTEIN

%

Time
% minutes
Yield
% servings
DONE recipeHero : string = #string DONE
Steak
DONE