Re: pretty printer and PCDATA (summary)

Subject: Re: pretty printer and PCDATA (summary)
From: Matthias Clasen <clasen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Sep 1999 15:50:27 +0200
>    I'm not quite sure what's needed here, either, but I'd guess that
> the goal is to get the contents of the element, as with (data), minus
> the trailing whitespace.  Perhaps something like:
> 
> (define ws '(#\U-0009 #\U-000A #\U-000D #\U-0020))
> (define data-trim (lambda (#!optional (nd (current-node)))
>   (let ((s (data nd))) (let loop ((l (string-length s)))
>     (cond ((= l 0) "") ((member (string-ref s (- l 1)) ws) (loop (- l 1)))
>           (else (substring s 0 l)))))))
> 
>    Note that this only strips the whitespace at the end, though it
> could be modified without too much trouble to strip it at both ends.
> Note, also, that I used "Unicode" syntax to specify my whitespace
> characters, first because Jade has no character name for tab built in
> (though, it looks like it would pick it up, if the SGML declaration
> specifically named it...?), and second because earlier versions
> didn't have line-feed or carriage-return.  The definition of

jade won't pick it up from the SGML declaration, but for OpenJade
you can add a <standard-chars>horizontal-tab 9</standard-chars>
declaration to your style sheet and use #\horizontal-tab instead
of #\U-0009.


-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: clasen@xxxxxxxxxxxxxxxxxxxxxxxxxx
Mathematisches Institut, Albert-Ludwigs-Universitaet Freiburg


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread