Discussion:
Evaluating forms inside of with-html-output-to-string
Andrew Pennebaker
2011-03-02 07:13:12 UTC
Permalink
According to the documentation, with-html-output-to-string can evaluate Lisp
forms. In my experience, this is not the case.

(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil
:indent t)
(:p (concatenate 'string "abc" "def")))

Should return

"<p>
abcdef
</p>"

but it actually returns

"<p>
</p>"

Specs:

- Lispbox CCL 1.6
- Mac OS X 10.6.6 and Ubuntu 10.10 Maverick

Cheers,
Andrew Pennebaker
Osei Poku
2011-03-02 07:23:46 UTC
Permalink
Try:

(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent t)
(:p (str (concatenate 'string "abc" "def"))))

i.e., enclose the lisp form generating the string with (str )

Osei
According to the documentation, with-html-output-to-string can evaluate Lisp forms. In my experience, this is not the case.
(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent t)
(:p (concatenate 'string "abc" "def")))
Should return
"<p>
abcdef
</p>"
but it actually returns
"<p>
</p>"
• Lispbox CCL 1.6
• Mac OS X 10.6.6 and Ubuntu 10.10 Maverick
Cheers,
Andrew Pennebaker
_______________________________________________
cl-who-devel site list
http://common-lisp.net/mailman/listinfo/cl-who-devel
Andrew Pennebaker
2011-03-02 22:56:51 UTC
Permalink
Thanks for suggesting (str).

The correct code (without importing the cl-who package):

(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil
:indent t)
(:p (cl-who:str (concatenate 'string "abc" "def"))))

The current docs <http://weitz.de/cl-who/#str> don't say anything about
(format nil) not working inside of with-html-output-to-string; they just say
that (str) has no binding. A simple notice would aid new Lispers, myself
included.

Cheers,

Andrew Pennebaker
www.yellosoft.us
Post by Osei Poku
(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent t)
(:p (str (concatenate 'string "abc" "def"))))
i.e., enclose the lisp form generating the string with (str )
Osei
Post by Andrew Pennebaker
According to the documentation, with-html-output-to-string can evaluate
Lisp forms. In my experience, this is not the case.
Post by Andrew Pennebaker
(cl-who:with-html-output-to-string (*standard-output* nil :prologue nil
:indent t)
Post by Andrew Pennebaker
(:p (concatenate 'string "abc" "def")))
Should return
"<p>
abcdef
</p>"
but it actually returns
"<p>
</p>"
• Lispbox CCL 1.6
• Mac OS X 10.6.6 and Ubuntu 10.10 Maverick
Cheers,
Andrew Pennebaker
_______________________________________________
cl-who-devel site list
http://common-lisp.net/mailman/listinfo/cl-who-devel
_______________________________________________
cl-who-devel site list
http://common-lisp.net/mailman/listinfo/cl-who-devel
Edi Weitz
2011-03-03 07:12:45 UTC
Permalink
On Wed, Mar 2, 2011 at 11:56 PM, Andrew Pennebaker
The current docs don't say anything about (format nil) not working inside of
with-html-output-to-string; they just say that (str) has no binding.
The section "Syntax and Semantics" explains this in detail. I guess
you just didn't read that...

Loading...