mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Drop (chibi sxml) dependency on let-optionals
let-optionals can be provided by the (chibi optional) library or by SRFI 227. Either dependency is non-trivial and makes it tricky to incorporate (chibi sxml) into outside projects. Since (chibi sxml) only makes trivial use of let-optionals, expand the macro by hand.
This commit is contained in:
parent
2dc7dd5b68
commit
561fc1bae0
2 changed files with 7 additions and 4 deletions
|
@ -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))
|
||||||
|
|
|
@ -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"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue