[plt-scheme] string->html/response

From: maxigas (maxigas at anargeek.net)
Date: Sat Dec 27 19:28:31 EST 2008

From: "Jay McCarthy" <jay.mccarthy at gmail.com>
Subject: Re: [plt-scheme] string->html/response
Date: Wed, 17 Dec 2008 06:45:40 -0700
> Mirrors is great. But just to clarify, you can get raw unquoted
> strings in the X-expression syntax with cdata structs:
> 
> Examples:
> 
> (make-cdata #f #f "<b>bold</b>")

thank you.  finally, i used this method with total success. :)

this is how:

---8k---{snip..snip..}---

(define (load r b t)
  (let ((o (title->post b t)))
  `(html (head (title "Stratified Blog") ,css)
         (body (div ((id "level1")) "Stratified Blog")
               (div ((id "level2"))  ,(post-title o))
               (div ((id "level3"))  ,@(map (lambda (x) (string-append " " (symbol->string x))) (post-tags o)))
               (div ((id "content")) ,(make-cdata #f #f (post-body o)))))))

(define (file->string f)
  (let ((datum (read-line f)))
    (if (eof-object? datum)
        ""
        (string-append datum (file->string f)))))

---8k---{snip..snip..}---

maxigas


Posted on the users mailing list.