(load (string-append laml-dir "laml.scm")) (laml-style "simple-xhtml1.0-transitional-validating") (lib-load "xhtml1.0-convenience.scm") (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")) (define ttl "My Favorite Recipies") (define (mark-as m) (xml-in-laml-abstraction (lambda (c a) (span c 'class m)))) (define ingredient (mark-as "ingredient")) (define step (mark-as "step")) (define comment (mark-as "comment")) (define (get-asts content-list what) (filter (lambda (x) (and (ast? x) (equal? (ast-element-name x) "span") (equal? (ast-attribute x 'class) what))) content-list)) (define recipe (xml-in-laml-abstraction (lambda (c a) (let ((title (defaulted-get-prop 'title a "NO TITLE")) (ingredient-list (get-asts c "ingredient")) (step-list (get-asts c "step")) (comment (get-asts c "comment"))) (div 'css:margin-bottom "2cm" (span "Recipe:" title) (br) "Ingredients:" (br) (ul (map li ingredient-list)) "Procedure:" (br) (ol (map li step-list)) (font 'size "1" comment)))))) (write-html '(pp prolog) (html html-props (head (meta meta-props) laml-generation-meta (title ttl)) (body (h1 ttl) (recipe 'title "Pita Bread" (ingredient "1.5 tsp dry yeast") (ingredient "1 cup water") (ingredient "...") (step "Dissolve the yeast") (step "Add honey, folur and salt") (step "...")) (recipe 'title "Apricot Compote" (ingredient "3 cups dried pears") (ingredient "0.5 cups maple suryp") (ingredient "...") (step "Cook the pears, sury and water") (step "...") (comment "Tastes" (b "ugly") )) ) ) ) (end-laml)