(set 'title "Today")
(pr
[text]Content-type: text/html
<html>
<head>
<title>#{title}</title>
</head>
<body>
<p>Today is #{(now)}</p>
</body>
</html>
[/text])
I have done some other stuff like put (const (global '<html>) "<html>\n") etc. in the init.lsp and it helps like the following
[code]
(pr cgi-header
<html>
<body>
...
</body>
</html>
)
But I think being able to evaluate stuff in text tags would be much better. Is it possible?
There is a special function in cgi.lsp called (CGI:put-page somefile.html). This fnction replaces all <% .. %> in the page evaluating the expressions.
You just create a normal HTML page and embed <% (newlisp-expression) %>, the <%, %> tags enclose lisp expressions.
Then your cgi-file contains statements like (CGI:put-page MyPage.html). The advantage of this approach is, that your html page and code are (mostly) separated. Most HTML editors respect <% %> tags because other scripting languages use them too.
All of the newLISP application: ide, blog and wiki use this approach.