Merge pull request #913 from lassik/patches

Drop (chibi sxml) dependency on let-optionals
This commit is contained in:
Alex Shinn 2023-04-22 14:17:00 +09:00 committed by GitHub
commit 971f546833
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -91,9 +91,12 @@
;;> Render (valid, expanded) \var{sxml} as html. ;;> Render (valid, expanded) \var{sxml} as html.
;;> \var{@raw} tag is considered safe text and not processed or escaped. ;;> \var{@raw} tag is considered safe text and not processed or escaped.
(define (sxml-display-as-html sxml . o) (define (sxml-display-as-html sxml . args)
(let-optionals o ((out (current-output-port)) (let* ((out (if (null? args) (current-output-port) (car args)))
(indent? #false)) (args (if (null? args) args (cdr args)))
(indent? (if (null? args) #f (car args)))
(args (if (null? args) args (cdr args))))
(unless (null? args) (error "too many args"))
(let lp ((sxml (if (and (pair? sxml) (eq? '*TOP* (car sxml))) (let lp ((sxml (if (and (pair? sxml) (eq? '*TOP* (car sxml)))
(cdr sxml) (cdr sxml)
sxml)) sxml))

View file

@ -4,5 +4,5 @@
(define-library (chibi sxml) (define-library (chibi sxml)
(export sxml->xml sxml-display-as-html sxml-display-as-text sxml-strip (export sxml->xml sxml-display-as-html sxml-display-as-text sxml-strip
html-escape html-tag->string) html-escape html-tag->string)
(import (chibi optional) (scheme base) (scheme write)) (import (scheme base) (scheme write))
(include "sxml.scm")) (include "sxml.scm"))