From m212a at mac.com Fri Jun 25 07:47:03 2004
From: m212a at mac.com (Young Hoo Kim)
Date: Fri, 25 Jun 2004 00:47:03 -0700
Subject: [cl-who-devel] Is it bug?
Message-ID: <14303210.1088149623497.JavaMail.m212a@mac.com>
Hello,
when I evaluation this form,
(let ((page-title "title"))
(with-html-output-to-string (output-str)
(:title page-title)
output-str))
it return "
".
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.
From edi at agharta.de Fri Jun 25 08:02:59 2004
From: edi at agharta.de (Edi Weitz)
Date: Fri, 25 Jun 2004 10:02:59 +0200
Subject: [cl-who-devel] Is it bug?
In-Reply-To: <14303210.1088149623497.JavaMail.m212a@mac.com> (Young Hoo
Kim's message of "Fri, 25 Jun 2004 00:47:03 -0700")
References: <14303210.1088149623497.JavaMail.m212a@mac.com>
Message-ID: <87hdt0dpzg.fsf@bird.agharta.de>
On Fri, 25 Jun 2004 00:47:03 -0700, Young Hoo Kim wrote:
> when I evaluation this form,
>
> (let ((page-title "title"))
> (with-html-output-to-string (output-str)
> (:title page-title)
> output-str))
>
> it return "".
Yes, that's correct behaviour. According to the "Syntax and Semantics"
chapter () 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")))
"foo2"
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.