[cl-who-devel] Interpolate lisp code inside the tag body

Matus Kmit simply.nitaai at gmail.com
Thu Jul 28 08:44:31 UTC 2011


Yes, this helps. i think it also answers my second post -> one should
use "with-html-output-to-string"... Right?

Matus

On Thu, Jul 28, 2011 at 10:06 AM, Sebastian Tennant
<sebyte at smolny.plus.com> wrote:
> Quoth Matus Kmit <simply.nitaai at gmail.com>:
>> 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))))
>  => "<p attribute='value'></p>"
>
> 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)))))
>  => "<h1>Attributes and their values</h1>"
>
> Hope this helps,
>
> Sebastian
> --
> Emacs' AlsaPlayer - Music Without Jolts
> Lightweight, full-featured and mindful of your idyllic happiness.
> http://home.gna.org/eap
>
>
> _______________________________________________
> cl-who-devel site list
> cl-who-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-who-devel
>




More information about the Cl-who-devel mailing list