[cxml-devel] Ho do I write the following on a sink?

David Lichteblau david at lichteblau.com
Mon May 30 20:42:35 UTC 2011


Quoting Marco Antoniotti (marcoxa at cs.nyu.edu):
> 
> On May 27, 2011, at 18:43 , David Lichteblau wrote:
> > cxml:unescaped is the "official" solution to implement this.
> > Please use that.
> 
> That is not a solution.  I do not want to write (:p "And now" (cxml:unescaped "Λ") "!")
> (which, besides, does not work).

OK; at this level it's called sax:unescaped, not cxml:unescaped.  (In my
defence, I got this right in the previous email in this thread, where I
also gave the full argument list, indicating that it takes two
arguments, the sink and the string.)

I can only repeat that xhtml-generator is sample-code quality, and I
don't really support it.  But it's very easy to hack on and extend, and
that's what you can do if you are willing to dive into it:

(in-package :xhtml-generator)

(def-special-html :entity
  (lambda (ent args argsp body)
    `(sax:unescaped *html-sink* (format nil "&~(~A~);" ',(car body)))))

CL-USER> (let ((s (cxml:make-string-sink)))
           (sax:end-document
            (xhtml-generator:with-html s
              (:html (:body "foo" (:entity :foo) "bar"))
              s)))
"<html><body>foo&foo;bar</body></html>"




More information about the cxml-devel mailing list