I am using drakma to get the html and cl-html-parse to parse it. Let's say I need to parse and modify the html and use hunchentoot to handle the request giving out the new html. In cl-who I see only the macro with-html-output-to-string which prints html given a body of s-exp. In my case I will only have a list of s-exp like '(:div "some text"). If I give a list to with-html-output-to-string it will return an empty string. I am wondering is there a function inside cl-who that I can use to convert s-exp html list like '(:body "some body") to an HTML text? Or how can I use the with-html-output-to-string macro for the purpose?
Thank you, Andrew
On Sat, 24 Nov 2007 17:25:50 -0500, "Andrei Stebakov" lispercat@gmail.com wrote:
I am wondering is there a function inside cl-who that I can use to convert s-exp html list like '(:body "some body") to an HTML text?
No, unfortunately there isn't. I wanted to add that for quite some time now, but it implies a major rewrite of CL-WHO's internals and I don't have time for this ATM. Maybe you can use one the related tools like htout, LML, or htmlgen for this.
Edi.
I am wondering is there a function inside cl-who that I can use to convert s-exp html list like '(:body "some body") to an HTML text?
No, unfortunately there isn't. I wanted to add that for quite some time now, but it implies a major rewrite of CL-WHO's internals and I don't have time for this ATM. Maybe you can use one the related tools like htout, LML, or htmlgen for this.
I don't know if the innards of CL-WHO have changed in the two years since I wrote my code, but I did put together a hack that did exactly this, calling APPLY-TO-TREE and TREE-TO-TEMPLATE with a rewritten - AUX function.
Rather than walking an expression inside a macro, producing code to print HTML, we walk the form inside a function, printing strings directly.
I don't know if it still works, but it's under 100 lines, so you should be able to replicate it pretty easily.
-R
On Sat, 24 Nov 2007 15:52:06 -0800, Richard Newman rnewman@twinql.com wrote:
I don't know if the innards of CL-WHO have changed in the two years since I wrote my code, but I did put together a hack that did exactly this, calling APPLY-TO-TREE and TREE-TO-TEMPLATE with a rewritten - AUX function.
Rather than walking an expression inside a macro, producing code to print HTML, we walk the form inside a function, printing strings directly.
I don't know if it still works, but it's under 100 lines, so you should be able to replicate it pretty easily.
Why don't you send it to the list?
Here's my contribution; it still works in 0.9.1!
Please forgive any horrible hackiness you find -- this code was never written for public consumption :)
who(11): (tree-to-string '(:body (:b "Foo bar") (:i :style "baz" "boo"))) "<body><b>Foo bar</b><i style='baz'>boo</i></body>"
-R
On Sat, 24 Nov 2007 16:16:49 -0800, Richard Newman rnewman@twinql.com wrote:
Here's my contribution; it still works in 0.9.1!
Thanks. I'll have a look at it in the next days/weeks when I find some time.
Richard, I tried it and it works. I didn't test it for many cases only for some simple ones that I currently use. That would be great to integrate the functionality into cl-who.
Richard, Edi thank you for your support!
Andrew
On Nov 24, 2007 7:20 PM, Edi Weitz edi@agharta.de wrote:
On Sat, 24 Nov 2007 16:16:49 -0800, Richard Newman rnewman@twinql.com wrote:
Here's my contribution; it still works in 0.9.1!
Thanks. I'll have a look at it in the next days/weeks when I find some time.
cl-who-devel site list cl-who-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel