@@ -677,15 +677,15 @@ This sets the doctype to be html5 compatible <!DOCTYPE html>."
677677 ` (let ((, s-name , stream)) , content)
678678 ` (with-output-to-string (, s-name) , content)))
679679
680- (defmacro buffer-xml-output ((&optional stream ) &body body)
680+ (defmacro buffer-xml-output ((&optional stream sink ) &body body)
681681 " buffers out sax:events to a sting
682682
683683 xml parameters like <param:foo param:type=\" string\" ><div>bar</div></param:foo>
684684 are requested to be strings (presumably for string processing)
685685 "
686686 (alexandria :with-unique-names (out-str)
687687 (let ((content
688- ` (let ((cxml ::*sink* (cxml :: make-character-stream-sink , out-str))
688+ ` (let ((cxml ::*sink* (or , sink ( make-character-stream-sink , out-str) ))
689689 (cxml ::*current-element* nil )
690690 (cxml ::*unparse-namespace-bindings* cxml ::*initial-namespace-bindings* )
691691 (cxml ::*current-namespace-bindings* nil ))
@@ -695,7 +695,7 @@ This sets the doctype to be html5 compatible <!DOCTYPE html>."
695695 (sax :end-document cxml ::*sink* ))))
696696 (%enstream stream out-str content))))
697697
698- (defmacro %with-snippet ((type &optional stream ) &body body)
698+ (defmacro %with-snippet ((type &optional stream sink ) &body body)
699699 " helper to define with-html-snippet and with-xhtml-snippet"
700700 (assert (member type ' (with-html-document with-xhtml-document)))
701701 (alexandria :with-unique-names (out-str)
@@ -704,15 +704,15 @@ This sets the doctype to be html5 compatible <!DOCTYPE html>."
704704 (, type
705705 (let ((content (flatten-children (progn ,@ body))))
706706 (iter (for n in content)
707- (buffer-xml-output (, out-str) (buildnode ::dom-walk cxml ::*sink* n))))
707+ (buffer-xml-output (, out-str , sink ) (buildnode ::dom-walk cxml ::*sink* n))))
708708 nil ))))
709709 (%enstream stream out-str body)
710710 )))
711711
712- (defmacro with-html-snippet ((&optional stream ) &body body)
712+ (defmacro with-html-snippet ((&optional stream sink ) &body body)
713713 " builds a little piece of html-dom and renders that to a string / stream"
714- ` (%with-snippet (with-html-document , stream) ,@ body))
714+ ` (%with-snippet (with-html-document , stream , sink ) ,@ body))
715715
716- (defmacro with-xhtml-snippet ((&optional stream ) &body body)
716+ (defmacro with-xhtml-snippet ((&optional stream sink ) &body body)
717717 " builds a little piece of xhtml-dom and renders that to a string / stream"
718- ` (%with-snippet (with-xhtml-document , stream) ,@ body))
718+ ` (%with-snippet (with-xhtml-document , stream , sink ) ,@ body))
0 commit comments