From: Jonathan Heusser
Subject: markup languages and webdesigners
Date: 
Message-ID: <dql3rm$7eq$1@news.hispeed.ch>
Hi,

What I often wonder about when looking at the different markup languages
available for common lisp: If you have webdesigners creating a big html
website for you with lots of elements and well placed graphics, how do
you bring together a markup language like CL-WHO (just as an example)
and the html code of that site? My designers don't talk lisp.

Where I really see the advantages of having the same syntax for the
webstuff and the programming itself I see the point I mentioned above as
a bit problematic. I could translate the whole html into s-expressions,
but then again the webdesigner can't change the layout anymore.

How do non-trivial html sites, served by lisp, handle that?

thanks
jonathan
--

From: Petter Gustad
Subject: Re: markup languages and webdesigners
Date: 
Message-ID: <87d5ipvmuz.fsf@filestore.home.gustad.com>
Jonathan Heusser <················@gmx.net> writes:

> How do non-trivial html sites, served by lisp, handle that?

Allegroserve/Webactions will let you design the webpages in a regular
html editor and then call common lisp server pages (clp) functions
which generates the only the dynamic part of the the html code. Make
sure your cpl functions return clean html which contains css tags and
no layout information and leave the graphical part to the designers.

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: Rob Warnock
Subject: Re: markup languages and webdesigners
Date: 
Message-ID: <HIedneXZ2v6zV03eRVn-ig@speakeasy.net>
Jonathan Heusser  <················@gmx.net> wrote:
+---------------
| What I often wonder about when looking at the different markup languages
| available for common lisp: If you have webdesigners creating a big html
| website for you with lots of elements and well placed graphics, how do
| you bring together a markup language like CL-WHO (just as an example)
| and the html code of that site? My designers don't talk lisp.
+---------------

Several of the pages on <http://www.cliki.net/web> address this issue.
One approach is to embed some sort of escape code in the HTML that calls
out to Lisp, perhaps using the <% ... %> brackets that ASP, JSP, or LSP
use or the <?foo ... ?> bracketing that PHP or XML "processing" use.
The following shows one example of this style:

    http://www.cliki.net/CL-EMB
    http://common-lisp.net/project/cl-emb/examples.html

It can embed either raw Lisp such as calls to CL-WHO or HTOUT:

    <h1>Music links</h1>
    <%
    (cl-who:with-html-output (*standard-output*)
      (loop for (link . title) in 
	    '(("http://zappa.com/" . "Frank Zappa")
	      ("http://marcusmiller.com/" . "Marcus Miller")
	      ("http://www.milesdavis.com/" . "Miles Davis"))
	    do (cl-who:htm (:a :href link
			       (:b (cl-who:str title)))
			   :br)))
    %>

or or it also provides a kind of higher-level macro language:

    <h1>Music links</h1>
    <% @loop music-list %>
    <a href="<% @var link %>"><b><% @var title -escape html%></b></a><br />
    <% @endloop %>

Here are a few other packages picked at random that do similar things:

    http://www.cliki.net/clhp
    http://www.cliki.net/HTML-TEMPLATE
    http://www.cliki.net/KPAX
    http://www.cliki.net/LSP
    ...[there are more]...

Whichever you pick [or if you write your own], I would suggest that
you put as little actual Lisp within the brackets as possible [mainly
calls to pre-defined functions], and that you only allow complete
s-exprs within a bracketed expression. Otherwise it can be quite hard
to keep the Lisp parens and subforms balanced and/or nested properly
when there's a huge amount of raw HTML splitting them apart. About a
year ago, Frank Buss gave a tiny example of the "bad" style, which is
similar to the coding style one tends to find in JSP & PHP pages, too:

    <% (dotimes (i 10) %>
      <img src="mr-yuck.jpg">
    <% ) %>

Finally, it's up to how you write your server whether the pages
are parsed to pick the Lisp bits out of the HTML every time the
page is accessed, or only the first time the page is accessed
after being changed, or only once period using some off-line
preprocessing program [which must presumably be re-run whenever
source pages are changed!]. Different implementations have used
different strategies in the past; each has its plusses & minusses.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607