From: WalterGR
Subject: Embedding Lisp in arbitrary text files (or: "Lisp server pages")
Date: 
Message-ID: <ea32526a-8a89-49cf-a9b5-e3ef6a099bb4@g1g2000pra.googlegroups.com>
I'm looking for a Lisp library to create text output a la e.g. ASP,
JSP, PHP, or erb.  (That is, embedding arbitrary Lisp expressions in
text files, which are then evaluated to create text output.)  So far
I've found:

LSP - http://www.cliki.net/LSP
LSP for Hunchentoot - http://common-lisp.net/pipermail/tbnl-devel/2007-May/001324.html
XLMP - http://sourceforge.net/projects/lsp
CLHP - http://common-lisp.net/project/clhp/

I've also come across ALP [1] which is a research paper but no code.
CL-EMB [2] supports the "server pages" style, but requires passing an
"environment" to the evaluation function.  This isn't ideal.

Have I missed any?  Does anyone have experience with the above
libraries?

Thanks,

Walter


[1] http://www.ai.sri.com/software/alp
[2] http://common-lisp.net/project/cl-emb/

From: Petter Gustad
Subject: Re: Embedding Lisp in arbitrary text files (or: "Lisp server pages")
Date: 
Message-ID: <87iqoolgi5.fsf@pangea.home.gustad.com>
WalterGR <········@gmail.com> writes:

> Have I missed any?  Does anyone have experience with the above
> libraries?

Common Lisp Server Pages under Portable-AllegroServe/Webactions:

http://opensource.franz.com/aserve/aserve-dist/webactions/doc/webactions.html

I've been very happy with this combination with CL-SQL under
SBCL/Linux. However, this is probably not the most popular combination
as it seems like a lot of people adopt to Hunchentoot these days.

Petter
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: WalterGR
Subject: Re: Embedding Lisp in arbitrary text files (or: "Lisp server pages")
Date: 
Message-ID: <db5101c0-2320-48a8-85fd-191517d9a837@v39g2000pro.googlegroups.com>
On Jan 9, 6:07 am, Petter Gustad <·············@gustad.com> wrote:
> WalterGR <········@gmail.com> writes:
> > Have I missed any?  Does anyone have experience with the above
> > libraries?
>
> Common Lisp Server Pages under Portable-AllegroServe/Webactions:
>
> http://opensource.franz.com/aserve/aserve-dist/webactions/doc/webacti...

It doesn't appear that CLPs permit "embedding arbitrary Lisp
expressions," unless I've missed something.

Thanks,

Walter
From: Petter Gustad
Subject: Re: Embedding Lisp in arbitrary text files (or: "Lisp server pages")
Date: 
Message-ID: <87vdsjwbr4.fsf@pangea.home.gustad.com>
WalterGR <········@gmail.com> writes:

> It doesn't appear that CLPs permit "embedding arbitrary Lisp
> expressions," unless I've missed something.

Not directly, but indirectly by defining clp functions. 

Petter
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: D Herring
Subject: Re: Embedding Lisp in arbitrary text files (or: "Lisp server pages")
Date: 
Message-ID: <4968006e$0$1601$6e1ede2f@read.cnntp.org>
WalterGR wrote:
> I'm looking for a Lisp library to create text output a la e.g. ASP,
> JSP, PHP, or erb.  (That is, embedding arbitrary Lisp expressions in
> text files, which are then evaluated to create text output.)  So far
> I've found:
...


Whatever you choose, Terence Parr makes a good argument for functional 
template design.  In a nutshell, the output is a simple cross product 
of the template format and the specific data.  Mixing fancier code in 
with the templates tends to be bad.

I recommend reading a couple of his papers before getting started.

http://www.stringtemplate.org/about.html

- Daniel
From: Stanisław Halik
Subject: Re: Embedding Lisp in arbitrary text files (or: "Lisp server pages")
Date: 
Message-ID: <gkpcqh$2auf$1@opal.icpnet.pl>
thus spoke WalterGR <········@gmail.com>:

> I'm looking for a Lisp library to create text output a la e.g. ASP,
> JSP, PHP, or erb.  (That is, embedding arbitrary Lisp expressions in
> text files, which are then evaluated to create text output.)  So far

So here's my EMIT-HTML library, a glorified reader hack:
http://tehran.lain.pl/gitweb?p=emit-html.git;a=summary

Sample usage:

> (emit-html:enable-angle-html-syntax)
T
> {html
   {head {title "foobar!"}}
   {body {h3 "foo!"}
         {p :align "justify" "some" "thing"}
         {p "Every string is escaped: <>&"}
         (format t "But this is not: <foo>")
         {p (emit-html:esc (identity "stuff can be <escaped> at runtime"))}}}

Which leads to predictable output. I made it so i wouldn't have to
escape every single user-supplied string, forget some cases and get
bitten by cross-site scripting a year later.

The reader hack even works with paredit and emacs' paren-matching. Yay!

</shameless-plug>

-- 
You only have power over people so long as you don’t take everything
away from them. But when you’ve robbed a man of everything he’s no longer
in your power — he’s free again. -- Aleksandr Isayevich Solzhenitsyn