Subject: breaking a string at record ends From: Jany Quintard <quintard.j@xxxxxx> Date: Wed, 6 Sep 2000 18:12:48 +0200 (CEST) |
For some obscure reason, I have to convert an example element (<xmp>) in an HTML paragraph with <br> at end of lines. My xmp look like : <xmp> first line second line ... nth line </xmp> I know it would be simpler (and cleaner) to use a pre element with a rule like (element xmp (make element gi: "pre" (process-children))) But life is complicated and I have to output something like : <p> first line <br> second line <br> ... So I process the contents of xmp with a function : (define (output-xmp liste) (let loop ((chars liste) (result (empty-sosofo))) (if (null? chars) result (loop (cdr chars) (sosofo-append result (if (char-property 'record-end? (car chars)) (make empty-element gi: "br") (literal (string (car chars))))))))) This works, but I am none too proud of it. The "(literal (string (car chars)))" seems *very* complicated and I wonder if there is not a better way to do it (using (make character) maybe ?). Any hints ? TIA. Jany DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
The DSSSL monster is in fact a gent, Lorand Bruhacs | Thread | Re: breaking a string at record end, Brandon Ibach |
The DSSSL monster is in fact a gent, Lorand Bruhacs | Date | Re: breaking a string at record end, Brandon Ibach |
Month |