From 004d48222b0b69c84d73d8a17ae78603fd1b58e3 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 29 Sep 2002 23:52:47 +0000 Subject: [PATCH] Fixes. --- scm/to-xml.scm | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scm/to-xml.scm b/scm/to-xml.scm index 47e8a6cf9b..76d78585d3 100644 --- a/scm/to-xml.scm +++ b/scm/to-xml.scm @@ -99,6 +99,12 @@ is then separated. (define (re-sub re to string) (regexp-substitute/global #f re string 'pre to 'post)) +(define (re-sub-alist string alist) + (re-sub (caar alist) (cdar alist) + (if (pair? (cdr alist)) + (re-sub-alist string (cdr alist)) + string))) + (define (open-tag tag attrs exceptions) (define (candidate? x) (not (memq (car x) exceptions))) @@ -115,20 +121,13 @@ is then separated. (symbol->string sym) "=\"" - (let ((s (call-with-output-string (lambda (port) (display val port))))) - ;; ugh - (re-sub - "\"" """ - (re-sub - "<" "<" - (re-sub - ">" ">" - (re-sub - "'" "'" - (re-sub - "&" "&" s)))))) - + (re-sub-alist s '(("\"" . """) + ("<" . "<") + (">" . ">") + ("'" . "'") + ("&" . "&")))) + "\"" ))) -- 2.39.2