From a220dea8eaf9eb1f1b310ad5d17597f57e939c89 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 18 Jul 2004 04:34:06 +0000 Subject: [PATCH] Allow HTML:COMMENT to take anything that satisfies XML-CHAR-DATA? as an argument. Also, be a little smarter about when to add leading or trailing whitespace. --- v7/src/xml/xhtml.scm | 13 +++++++++++-- v7/src/xml/xml.pkg | 6 ++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/v7/src/xml/xhtml.scm b/v7/src/xml/xhtml.scm index 1a7ec8cba..a2f3921ad 100644 --- a/v7/src/xml/xhtml.scm +++ b/v7/src/xml/xhtml.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: xhtml.scm,v 1.4 2004/07/15 19:50:43 cph Exp $ +$Id: xhtml.scm,v 1.5 2004/07/18 04:34:00 cph Exp $ Copyright 2002,2003,2004 Massachusetts Institute of Technology @@ -277,4 +277,13 @@ USA. "")))) (define (html:comment . strings) - (make-xml-comment (string-append " " (apply string-append strings) " "))) \ No newline at end of file + (make-xml-comment + (let* ((s (apply string-append (map canonicalize-char-data strings))) + (ws (utf8-string->wide-string s)) + (n (wide-string-length ws))) + (if (fix:> n 0) + (string-append + (if (char-whitespace? (wide-string-ref ws 0)) "" " ") + s + (if (char-whitespace? (wide-string-ref ws (fix:- n 1))) "" " ")) + " ")))) \ No newline at end of file diff --git a/v7/src/xml/xml.pkg b/v7/src/xml/xml.pkg index 0abe67572..8fedd0f68 100644 --- a/v7/src/xml/xml.pkg +++ b/v7/src/xml/xml.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: xml.pkg,v 1.43 2004/07/12 19:08:36 cph Exp $ +$Id: xml.pkg,v 1.44 2004/07/18 04:34:06 cph Exp $ Copyright 2001,2002,2003,2004 Massachusetts Institute of Technology @@ -266,7 +266,9 @@ USA. %make-xml-parameter-!entity %make-xml-parameter-entity-ref %make-xml-processing-instructions - %make-xml-unparsed-!entity)) + %make-xml-unparsed-!entity) + (export (runtime xml html) + canonicalize-char-data)) (define-package (runtime xml parser) (files "xml-chars" "xml-parser") -- 2.25.1