----- (define (sxml->PCDATA t b) (define (string->HTML b) (string->goodHTML (with-output-to-string (lambda () (SRV:send-reply b))))) (fprintf (current-error-port) "Body: ~S\n~A" (cdr b) (with-output-to-string (lambda () (pp (cdr b))))) (entag t (match (if (null? b) '() (car b)) (('@ . attr-list) (list (car b) (string->HTML (cdr b)))) (else (list (string->HTML b)))))) (define html-rules `((literal *preorder* . ,(lambda (t b) b)) (textarea . ,sxml->PCDATA) . ,universal-conversion-rules*)) (define (waffle-sxml->html sxml) (let* ((widget-rules `((*text* . ,(lambda (tag str) str)) (*default* . ,cons) (*TOP* . ,(lambda (tag str) str)) . ,(widget-rules) ; Each widget needs its own rule as we can't use *macro* with *default* without creating an endless loop. ))) (SRV:send-reply (pre-post-order* (pre-post-order* sxml widget-rules) html-rules)))) ----- #;> (waffle-sxml->html '(textarea "This is \"my\" hub." (subtree "are us"))) Body: ((#\newline #\< subtree (#\> ("are us") "))) ((#\newline #\< subtree (#\> ("are us") "))) #t