From simply.nitaai at gmail.com Thu Jul 28 07:12:46 2011
From: simply.nitaai at gmail.com (Matus Kmit)
Date: Thu, 28 Jul 2011 09:12:46 +0200
Subject: [cl-who-devel] Interpolate lisp code inside the tag body
Message-ID:
Hello
i just starting working with cl-who and i have one very basic question:
How does one properly embed and evaluate lisp code inside the tag body?
Let's say i have a function "fn" which returns a string and i want to
embed its value in a tag, like:
(: p (fn)) -> that does not work.
Thanks for help
Matus
From sebyte at smolny.plus.com Thu Jul 28 08:06:06 2011
From: sebyte at smolny.plus.com (Sebastian Tennant)
Date: Thu, 28 Jul 2011 08:06:06 +0000
Subject: [cl-who-devel] Interpolate lisp code inside the tag body
References:
Message-ID: <62mmvngx.fsf@chimera.gnukahvesi.net>
Quoth Matus Kmit :
> How does one properly embed and evaluate lisp code inside the tag body?
You can 'embed' the *value* of an attribute, but not attributes themselves.
In practice this is not a serious limitation.
> (:p (fn)) does not work.
No, but this does:
(flet ((fn () "value"))
(with-html-output-to-string (s)
(:p :attribute (fn))))
=> ""
Note, that to do something similar in the text node of an element, you should
use one of the exported symbols; esc, fmt or str.
http://weitz.de/cl-who/#esc
For example:
(flet ((fn () "Attributes and their values"))
(with-html-output-to-string (s)
(:h1 (str (fn)))))
=> "Attributes and their values
"
Hope this helps,
Sebastian
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
From simply.nitaai at gmail.com Thu Jul 28 08:23:44 2011
From: simply.nitaai at gmail.com (Matus Kmit)
Date: Thu, 28 Jul 2011 10:23:44 +0200
Subject: [cl-who-devel] Interpolate lisp code inside the tag body
In-Reply-To:
References:
Message-ID:
Let me specify further my question. if i do:
(with-html-output (*standard-output*) (:body (:p (str (fn))))
then the generated html code is correct but the return string is not complete:
text
"
text