Hello,
when I evaluation this form,
(let ((page-title "title")) (with-html-output-to-string (output-str) (:title page-title) output-str))
it return "<title></title>".
I suppose page-title in (:title) form isn't expanded as expected.
On the other hand,
this form
(let ((name "name") (checked t) (value nil)) (with-html-output-to-string (string) (:input :type "checkbox" :name name :checked checked :value value) string))
works as expected.
So I suppose only one-tag form (like (:title) or (:br) or (:p)) has this bug.
My environment is mac os x.3, lispworks 4.3, cl-who 0.4.0.
Thanks for any advance,
Hoo.
On Fri, 25 Jun 2004 00:47:03 -0700, Young Hoo Kim m212a@mac.com wrote:
when I evaluation this form,
(let ((page-title "title")) (with-html-output-to-string (output-str) (:title page-title) output-str))
it return "<title></title>".
Yes, that's correct behaviour. According to the "Syntax and Semantics" chapter (http://weitz.de/cl-who/#syntax) only literal strings in the body of a tag are printed verbatim. PAGE-TITLE is not a string but a symbol so it will be left as is. What you want is
(with-html-output-to-string (output-str) (:title (str page-title)))
assuming that the variable PAGE-TITLE holds a string.
Also note that including the symbol OUTPUT-STR at the end of the body of WITH-HTML-OUTPUT-TO-STRING does nothing.
I suppose page-title in (:title) form isn't expanded as expected.
No, it works fine.
On the other hand, this form
(let ((name "name") (checked t) (value nil)) (with-html-output-to-string (string) (:input :type "checkbox" :name name :checked checked :value value) string))
works as expected.
NAME, CHECKED and VALUE are evaluated here because they're not in the body of the form but in attribute position. Again, see the chapter about "Syntax and Semantics", specifically the part beginning with the sentence "The form denoting the attribute's value will be treated as follows."
* (let ((foo1 "foo1")) (with-html-output-to-string (s) (:bar :attr1 foo1 :attr2 "foo2" foo1 "foo2")))
"<bar attr1='foo1' attr2='foo2'>foo2</bar>"
Note that "foo1" appears in attribute position but not in the body.
So I suppose only one-tag form (like (:title) or (:br) or (:p)) has this bug.
There's no bug here.
Cheers, Edi.