I've just started playing with Parenscript and feel confused about HTML generation. Since Parenscript already includes (the unexported) process-html-forms, it seems to be able to (almost) handle much of the logic for simple HTML generation. Consider that
(parenscript::process-html-forms `(:html (:head (:title "ParenScript tutorial: 1st example")) (:body (:h1 "ParenScript tutorial: 1st example") (:p "Please click the link below." :br ((:a :href "#" :onclick ,(ps-inline (alert "Hello World"))) "Hello World")))))
produces
(+ "<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>")
It's easy to refactor process-html-forms to arrive at the (slightly incorrect) HTML in a string:
"<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>"
and probably easy to futz with *js-inline-string-delimiter* and the like to get the correct quotes around the body of the onclick handler.
So... since Parenscript doesn't do this, I have to ask "Why not"?! It would be nice to use Parenscript for simple HTML generation without having to get (Portable) AServe or some other more full-featured HTML generator. Am I missing something?
thanks, -- Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM
Hello,
It's easy to refactor process-html-forms to arrive at the (slightly incorrect) HTML in a string:
"<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>"
and probably easy to futz with *js-inline-string-delimiter* and the like to get the correct quotes around the body of the onclick handler.
The *js-inline-string-delimiter* is a bit of a hack right now. It would be nice if I could figure out a way of automatically integrating the ParenScript printer with different HTML output facilities to choose the correct string delimiters.
So... since Parenscript doesn't do this, I have to ask "Why not"?! It would be nice to use Parenscript for simple HTML generation without having to get (Portable) AServe or some other more full-featured HTML generator. Am I missing something?
I don't think you're missing anything Gary. It's pretty much a matter of replacing "+" with "concatenate 'string."
On the other hand, the HTML generation really isn't core to Parenscript (a few people have complained about it in the past), but it does come in very useful. I don't think it's worth it to put it into a separate project (there are much better tools like CL-WHO and LML2 if you just want to generate HTML from Lisp). What I will probably do is as you suggest and export that interface for those who want to use the Parenscript HTML generation facility throughout for something light-weight. If JavaScript came with streams built-in, what I would probably do is make a wrapper for CL-WHO output.
Speaking of CL-WHO, would anyone object if I changed the syntax of the Parenscript HTML markup to be like that of CL-WHO?
Thanks, Vladimir
On the other hand, the HTML generation really isn't core to Parenscript (a few people have complained about it in the past), but it does come in very useful. I don't think it's worth it to put it into a separate project (there are much better tools like CL-WHO and LML2 if you just want to generate HTML from Lisp). What I will probably do is as you suggest and export that interface for those who want to use the Parenscript HTML generation facility throughout for something light-weight. If JavaScript came with streams built-in, what I would probably do is make a wrapper for CL-WHO output.
Cool.
Speaking of CL-WHO, would anyone object if I changed the syntax of the Parenscript HTML markup to be like that of CL-WHO?
That seems like a good idea. -- Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM
I guess I still haven't gotten the darcs post-apply hook right, because this morning I pushed out the change that made ps-html work in both Parenscript and CL. I also decided to get rid of CSS generation altogether; chief reason being I didn't like the code and didn't want to rewrite it, secondary reason being that right now it is not a good idea to futz around with CSS on the client side for performance reasons (which is why I didn't want to rewrite the code).
The one thing I didn't do was to provide CL-WHO like HTML markup. That will have to wait a little bit.
Vladimir
On Dec 6, 2007 7:15 PM, Gary King gwking@metabang.com wrote:
I've just started playing with Parenscript and feel confused about HTML generation. Since Parenscript already includes (the unexported) process-html-forms, it seems to be able to (almost) handle much of the logic for simple HTML generation. Consider that
(parenscript::process-html-forms `(:html (:head (:title "ParenScript tutorial: 1st example")) (:body (:h1 "ParenScript tutorial: 1st example") (:p "Please click the link below." :br ((:a :href "#" :onclick ,(ps-inline (alert "Hello World"))) "Hello World")))))
produces
(+ "<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>")
It's easy to refactor process-html-forms to arrive at the (slightly incorrect) HTML in a string:
"<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>"
and probably easy to futz with *js-inline-string-delimiter* and the like to get the correct quotes around the body of the onclick handler.
So... since Parenscript doesn't do this, I have to ask "Why not"?! It would be nice to use Parenscript for simple HTML generation without having to get (Portable) AServe or some other more full-featured HTML generator. Am I missing something?
thanks,
Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
There is now a who-ps-html macro that provides CL-WHO like syntax, in addition to the ps-html macro. I've also made both preserve the cases of tag and attribute keywords when printing.
Vladimir
On Wed, Dec 26, 2007 at 6:59 PM, Vladimir Sedach vsedach@gmail.com wrote:
I guess I still haven't gotten the darcs post-apply hook right, because this morning I pushed out the change that made ps-html work in both Parenscript and CL. I also decided to get rid of CSS generation altogether; chief reason being I didn't like the code and didn't want to rewrite it, secondary reason being that right now it is not a good idea to futz around with CSS on the client side for performance reasons (which is why I didn't want to rewrite the code).
The one thing I didn't do was to provide CL-WHO like HTML markup. That will have to wait a little bit.
Vladimir
On Dec 6, 2007 7:15 PM, Gary King gwking@metabang.com wrote:
I've just started playing with Parenscript and feel confused about HTML generation. Since Parenscript already includes (the unexported) process-html-forms, it seems to be able to (almost) handle much of the logic for simple HTML generation. Consider that
(parenscript::process-html-forms `(:html (:head (:title "ParenScript tutorial: 1st example")) (:body (:h1 "ParenScript tutorial: 1st example") (:p "Please click the link below." :br ((:a :href "#" :onclick ,(ps-inline (alert "Hello World"))) "Hello World")))))
produces
(+ "<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>")
It's easy to refactor process-html-forms to arrive at the (slightly incorrect) HTML in a string:
"<html/><head><title>ParenScript tutorial: 1st example</title></ head><body><h1>ParenScript tutorial: 1st example</h1><p>Please click the link below.<br/><a href="#" onclick="javascript:alert("Hello World")">Hello World</a></p></body>"
and probably easy to futz with *js-inline-string-delimiter* and the like to get the correct quotes around the body of the onclick handler.
So... since Parenscript doesn't do this, I have to ask "Why not"?! It would be nice to use Parenscript for simple HTML generation without having to get (Portable) AServe or some other more full-featured HTML generator. Am I missing something?
thanks,
Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel@common-lisp.net