[gambit-list] handling of macros

Bradley Lucier lucier at math.purdue.edu
Tue Aug 9 17:34:23 EDT 2005


On Aug 8, 2005, at 1:17 PM, Christian wrote:

>> BTW, I've made some corrections to (that version of) your library  
>> and put that up with my latest version of chjmodule on http:// 
>> scheme.mine.nu/gambit/chjmodule/
>>
>
> To be more precise: these are the relevant changes out of the diff:
>
>
>  (define-type html
>    id: a121f3a9-a905-4db5-b2c2-6da0a7e47046
>    read-only:
> -  unprintable:
> +  ;;unprintable:  cj: why making debugging more difficult?
>
> --
>
>    (define (protect x)
>      (cond ((pair? x)
>             (for-each protect x))
>            ((html? x)
> -           (d (html-pre-tag x))
> +           ;;(d (html-pre-tag x))
> +          ;;cj: escape attribute values!:
> +          ;; example:  pre-tag: ("\n<p" (" onmousedown=" "fun") ("  
> align=" "center") ">")
> +          (let ((l (html-pre-tag x)))
> +            (d (car l))
> +            (let lp ((l (cdr l)))
> +              (if (not (null? l))
> +                  (let ((a (car l)))
> +                    (cond ((pair? a)
> +                           (d (car a))
> +                           (d #\")
> +                           (protect (cdr a))
> +                           (d #\"))
> +                          (else (d a)))
> +                    (lp (cdr l))))))
>             (protect (html-body x))

I just looked at the html-lib.scm I sent you, and indeed it does the  
same thing:

       (for-each (lambda (attribute)
           (##write-substring " " 0 1 port)
           (let ((name (attribute-name attribute)))
             (##write-substring name 0 (string-length name) port))
           (if (attribute-takes-value? attribute)
               (begin
             (##write-substring "=\"" 0 2 port)
             (protect (attribute-value attribute))
             (##write-substring "\"" 0 1 port))))
         (html-form-attributes x))

So I must have added the same capability after the version that Marc  
started with. Sorry for not noticing that before.

I tried to study the differences between the files using both diff  
and ediff in emacs, and the result was a mess.  Later I used the  
emacs "Indent region" command on both files before using ediff, and  
that helped.

I forgot the dt tag in the version that Marc and you used, so please add

(define-tag dt start-newline?: #t)

to your library.  I also changed a lot more tags to start a newline.   
Perhaps I should just do as Oleg does in

http://okmij.org/ftp/Scheme/SXML.scm

and have all block-level html plus <BR> start a newline.

Brad



More information about the Gambit-list mailing list