(load (string-append laml-dir "laml.scm")) (laml-style "simple-xhtml1.0-transitional-validating") (lib-load "xhtml1.0-convenience.scm") (set-xml-accept-extended-contents-in 'xhtml10-transitional #t) (define meta-props (list 'http-equiv "Content-Type" 'content "text/html; charset=iso-8859-1")) ; Return a meta text keywords from the emphasized words in the entire document. (define (count-elements el-name) (lambda (root-ast parent-ast) (length (match-ast root-ast (location-step 'descendant "p"))))) (define word (xml-in-laml-abstraction (lambda (c a) (lambda (root-ast parent-ast) (cond ((equal? (ast-element-name parent-ast) "b") (span 'css:font-size "150%" c a)) ((equal? (ast-element-name parent-ast) "em") (font 'color (rgb-color-encoding red) c a)) (else (list c a))))))) (write-html '(pp prolog) (html (head (meta meta-props) (title "Demo of simple document reflection")) (body (h1 "Illustration of element elements that depend on their immediate contexts." ) (p "This document shows who to define context sensite elements") (p "This is a demo of simple document introspection aided by" (word "delayed procedural content items")_ "." ) (p "A delayed procedural content item is a" (b (word "closure")) "which is evaluated at" (em (word "documentation expansion time")) _ "." ) (p "We show how to extract" (word "meta" "keywords") "from designated and marked up keywords in the text. Notice that the keyword element mirror function is produced by an XML-in-LAML abstraction." ) (when-generated)))) (end-laml)