Welcome to the CHICKEN Scheme pasting service
textarea PCDATA encoding pasted by andyjpb on Tue Sep 10 12:28:17 2013
----- (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.<x>" (subtree "are us"))) Body: ((#\newline #\< subtree (#\> ("are us") "</" subtree #\>))) ((#\newline #\< subtree (#\> ("are us") "</" subtree #\>))) <textarea>This is &quot;my&quot; hub.&lt;x&gt; <subtree>are us</subtree></textarea>#t
no title added by andyjpb on Tue Sep 10 13:28:59 2013
----- (define html-rules `((literal *preorder* . ,(lambda (t b) b)) ;(textarea . ,sxml->PCDATA) (textarea *preorder* . ,(lambda (t b) (cons t (map (lambda (c) (with-output-to-string (lambda () (waffle-sxml->html c)))) b)))) . ,universal-conversion-rules*)) ----- #;> (waffle-sxml->html '(textarea "This is \"my\" hub.<x>" (subtree (@ (y "z")) "are us"))) textareaThis is "my" hub.<x> <subtree y="z">are us</subtree>#t (waffle-sxml->html '(textarea (@ (hello "this is \"my\" life")) "This is \"my\" hub.<x>" (subtree (@ (y "z")) "are us"))) textarea@ hello="this is "my" life"This is "my" hub.<x> <subtree y="z">are us</subtree>#t