From gwking at metabang.com Fri Dec 7 03:15:32 2007
From: gwking at metabang.com (Gary King)
Date: Thu, 6 Dec 2007 22:15:32 -0500
Subject: [parenscript-devel] Generating HTML in parenscript
Message-ID:
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
> (+ "
ParenScript tutorial: 1st example
> head>ParenScript tutorial: 1st example
Please click
> the link below.
World\")\">Hello World
")
It's easy to refactor process-html-forms to arrive at the (slightly
incorrect) HTML in a string:
> "ParenScript tutorial: 1st example
Please click
> the link below.
World\")\">Hello World
"
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
From vsedach at gmail.com Tue Dec 18 20:29:58 2007
From: vsedach at gmail.com (Vladimir Sedach)
Date: Tue, 18 Dec 2007 12:29:58 -0800
Subject: [parenscript-devel] Generating HTML in parenscript
In-Reply-To:
References:
Message-ID:
Hello,
> It's easy to refactor process-html-forms to arrive at the (slightly
> incorrect) HTML in a string:
>
> > "ParenScript tutorial: 1st example
> > head>ParenScript tutorial: 1st example
Please click
> > the link below.
> World\")\">Hello World
"
>
>
> 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
From gwking at metabang.com Tue Dec 18 21:17:10 2007
From: gwking at metabang.com (Gary King)
Date: Tue, 18 Dec 2007 16:17:10 -0500
Subject: [parenscript-devel] Generating HTML in parenscript
In-Reply-To:
References:
Message-ID:
> 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
From vsedach at gmail.com Tue Dec 25 01:25:44 2007
From: vsedach at gmail.com (Vladimir Sedach)
Date: Mon, 24 Dec 2007 18:25:44 -0700
Subject: [parenscript-devel] Lisp-like shadowing behavior
In-Reply-To: <57952f8b0711061701y1e6999e3w982337bb591da460@mail.gmail.com>
References: <57952f8b0711061701y1e6999e3w982337bb591da460@mail.gmail.com>
Message-ID:
Instead of introducing a new special form or macro, I decided to
follow Common Lisp and make defvar define top-level special forms,
which are automatically dynamically bound by let. Now you need to use
the special form 'var' if you just want to define regular globals.
This, and a few other minor things are now in the darcs repository
(which should have sent a message to this group after my push, but I
guess I didn't configure it right, yet).
Merry X-mas,
Vladimir
On 11/6/07, Daniel Gackle wrote:
> Below is a ps macro that simulates the shadowing of special variables in
> Lisp. I'm wondering if anyone thinks this would be useful to add to
> Parenscript.
>
> I wrote it because I have some Javascript functions that reference global
> variables, and wanted to write some test functions for those without
> modifying global state. One option of course would be to simply write the
> original functions to take parameters instead of the global variables. But
> that complicates their signatures and I'm loath to modify production code to
> suit tests. With this macro, my test can do this:
>
> (ps (shadow-let ((*global-var* "test value"))
> (function-that-uses-global-var)))
>
> and the original value of *global-var* will be restored:
>
> var _js3778 = null;
> try {
> _js3778 = GLOBALVAR;
> GLOBALVAR = 'test value';
> functionThatUsesGlobalVar();
> } finally {
> GLOBALVAR = _js3778;
> };
>
> Daniel
>
> ------------------------------------------------------------------------
>
> (defpsmacro shadow-let (bindings &body body)
> (labels ((wrap-expr (bindings body)
> (if (null bindings)
> body
> (list (list 'temporarily-bind (car bindings) (wrap-expr (cdr bindings)
> body))))))
> `(macrolet ((temporarily-bind ((var expr) body)
> (with-ps-gensyms (temp)
> `(progn (defvar ,temp nil)
> (try (progn (setf ,temp ,var)
> (setf ,var ,expr)
> , at body)
> (:finally (setf ,var ,temp)))))))
> ,(cons 'progn (wrap-expr bindings body)))))
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
>
From vsedach at gmail.com Thu Dec 27 01:59:41 2007
From: vsedach at gmail.com (Vladimir Sedach)
Date: Wed, 26 Dec 2007 17:59:41 -0800
Subject: [parenscript-devel] Generating HTML in parenscript
In-Reply-To:
References:
Message-ID:
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 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
>
> > (+ "ParenScript tutorial: 1st example
> > head>ParenScript tutorial: 1st example
Please click
> > the link below.
> World\")\">Hello World
")
>
> It's easy to refactor process-html-forms to arrive at the (slightly
> incorrect) HTML in a string:
>
> > "ParenScript tutorial: 1st example
> > head>ParenScript tutorial: 1st example
Please click
> > the link below.
> World\")\">Hello World
"
>
>
> 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 at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
From danielgackle at gmail.com Mon Dec 31 22:57:30 2007
From: danielgackle at gmail.com (Daniel Gackle)
Date: Mon, 31 Dec 2007 15:57:30 -0700
Subject: [parenscript-devel] Bug in setf
Message-ID: <57952f8b0712311457k46bec24o7f07329016e0d5a6@mail.gmail.com>
There's a bug when using setf to decrement a variable:
(ps (setf x (- x 1 2)))
=> "x -= 1 - 2;"
Note that this works correctly:
(ps (setf x (- 1 x 2)))
=> "x = 1 - x - 2;"
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: