Discussion:
problem with w-h-o-t-s using str
Alok Thapa
2011-09-10 16:41:46 UTC
Permalink
Hi all,

When I evaluate this on the repl, it works as expected:

(with-html-output-to-string (*empty-stream*)
(:li :id "hello"
:class "active"
(:a :href "#"
"hello")))
"<li id=\"hello\" class=\"active\"><a href=\"#\">hello</a></li>"

but when I convert it into a function, then it gives me this:

(defun tab (page active)
(with-html-output-to-string (*empty-stream*)
(:li :id (str page)
:class (when (string-equal page active) (str "active"))
(:a :href "#"
(str page)))))
TAB
(tab "home" "home")

"<lihome id=\"home\"active class=\"active\"><a href=\"#\">home</a></li>"


Is there something I am doing wrong? I've already tried substituting str
with fmt and esc with no luck.

Thanks.

Alok
Alok Thapa
2011-09-10 17:00:54 UTC
Permalink
Please disregard. Problem fixed by not using str at all.

(defun tab (page active)
(with-html-output-to-string (*empty-stream*)
(:li :id page
:class (when (string-equal page active) "active")
(:a :href "#"
page))))
Post by Alok Thapa
Hi all,
(with-html-output-to-string (*empty-stream*)
(:li :id "hello"
:class "active"
(:a :href "#"
"hello")))
"<li id=\"hello\" class=\"active\"><a href=\"#\">hello</a></li>"
(defun tab (page active)
(with-html-output-to-string (*empty-stream*)
(:li :id (str page)
:class (when (string-equal page active) (str "active"))
(:a :href "#"
(str page)))))
TAB
(tab "home" "home")
"<lihome id=\"home\"active class=\"active\"><a href=\"#\">home</a></li>"
Is there something I am doing wrong? I've already tried substituting str
with fmt and esc with no luck.
Thanks.
Alok
Loading...