Back to notes -- Keyboard shortcut: 'u'              Slide 19 : 30
Program 1
 

(load (string-append laml-dir "laml.scm"))
(laml-style "simple-xhtml1.0-transitional-validating")

(define current-xml-language 'xhtml10-transitional)
(define laml-generation-meta (meta 'name "Generator" 'content "LAML"))
(define meta-props (list 'http-equiv "Content-Type" 'content "text/html; charset=iso-8859-1"))
(define html-props (list 'xmlns "http://www.w3.org/1999/xhtml"))

; Selectors
(define title-of-recipe second)
(define ingredient-list-of-recipe third)
(define steps-of-recipe fourth)

(define name-of-ingredient first)
(define amount-of second)
(define unit-of third)

(define (present-recipe r)
  (div 'class "recipe"
    (h3 (title-of-recipe r))
    (b "Ingredients")
    (ul      
      (map 
        (compose li present-ingredient) 
        (ingredient-list-of-recipe r)))
    (b "Procedure:")
    (ol(map li (steps-of-recipe r)))))

(define (present-ingredient ingr)
  (span (amount-of ingr) (unit-of ingr) (name-of-ingredient ingr)))


(define my-recipes
 (list
   '(recipe
      "Pita Bread"
      (("dry yeast" "1.5" "tsp")
       ("water" "1" "cup")
       ("..." "1" "..."))
      ("Dissolve the yeast"
       "Add honey, folur and salt" "..."))    

   '(recipe
      "Apricot Compote"
      (("pears" "3" "cups")
       ("maple surup" "0.5" "cup")
       ("..." "1" "..."))
      ("Cook the pears, sury and water"
      "...")) ))  


(write-html '(pp prolog)
 (html html-props
  (head 
   (meta meta-props) laml-generation-meta
   (title "My Recipes"))
  (body 
    (map present-recipe my-recipes))
 )
)


(end-laml)