[cells-devel] Cells + CL-WHO: Strange behavior - your help needed ...

Ken Tilton kennytilton at optonline.net
Sun May 13 13:03:57 UTC 2007


Frank Goenninger wrote:
> Hi Kenny -
> 
> Am 13.05.2007 um 03:51 schrieb Ken Tilton:
> 
>> The first problem was writing the html to standard output instead of a 
>> string, the second problem is that cl-who does not quite work the way 
>> you think. What I did was replace as-html with the appropriate 
>> with-html-output form and then macroexpand.
> 
> 
> Hm - ok - now that you say it ... Obviously the right thing to do. I was 
> looking for Cells misuse anywhere - wrong. It was the CL-WHO side which 
> I did not get right. Oh well....
> 
>> Give it a try. Meanwhile, this works:
>>
>> (defpackage #:whofix
>>   (:use #:common-lisp #:cells #:cl-who))
>>
>> (in-package :whofix)
>>
>> (defmacro as-html (var &body body)
>>   `(with-output-to-string (,var)
>>      (with-html-output (,var)
>>        , at body)
>>      ))
> 
> 
> As this is working as-html has to be changed because in CL-WHO  there's 
> 
> (defmacro with-html-output-to-string ((var &optional string-form
>                                            &key (element-type ''character)
>                                                 prologue
>                                                 indent)
>                                       &body body)
>   "Transform the enclosed BODY consisting of HTML as s-expressions
> into Lisp code which creates the corresponding HTML as a string."
>   `(with-output-to-string (,var ,string-form
>                                 #-(or :ecl :cmu :sbcl) :element-type
>                                 #-(or :ecl :cmu :sbcl) ,element-type)
>     (with-html-output (,var nil :prologue ,prologue :indent ,indent)
>       , at body)))
> 
> So, we can write:
> 
> (defmacro as-html (&body body)
>   `(with-html-output-to-string (*standard-output* nil :prologue nil)
>      , at body))
> 
> Hm - coming back to your remark 
>  
> 
>> the second problem is that cl-who does not quite work the way you think
> 
> 
> Well, I think I have understood that I have to output any data via 
> write-string because this is what is to be inserted between tags... 
> Anything else?

I actually have never used cl-who before, so I cannot help you on that 
last bit. I saw disappearing characters and guessed "stream issue", then 
macroexpanded the w-h-o call to see why I was still just getting hl-\hl.

kt




More information about the cells-devel mailing list