#lang scheme/base ;; -*- scheme -*- (require "../lib/facade.ss") ;; Format mostly static pages from projects with a little added ;; dynamism. The pages use scribble frontends. ;; TODO: Scribble reader frontent to raw xhtml. Something that reads fast. (require scheme/pretty scribble/reader web-server/servlet) ;; plt servlet interface (provide interface-version timeout start) (define interface-version 'v1) (define timeout +inf.0) ;; Read scribble syntax. This isn't all that interesting: it's better ;; to build on top of scribble/doc. ;; (define (scribble->x filename) ;; `(xhtml () ,@(with-input-from-file filename ;; (lambda () (read-inside))))) ;; Load scribble module in a namespace and extract the 'doc string, ;; and strip off all the scribble structure to generate a raw xhtml ;; page. (define (scribble->x filename) (let ((xhtml `(xhtml () ,@(parameterize ((current-namespace (make-base-namespace))) (eval `(begin (require scribble/struct) (require (file ,filename)) (apply append (map paragraph-content (flow-paragraphs (part-flow doc))))))) ))) ;; (pretty-print xhtml) xhtml)) ;; Read a file (define (start req) (define sym string->symbol) (define lst (req->list req)) (with-errors-to-browser send/finish (lambda () (scribble->x (path->string (apply build-path "/home/tom" (car lst) "www" (cdr lst)))))))