Subject: Re: HTML reader macro
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 22 May 2005 22:24:53 -0500
Newsgroups: comp.lang.lisp
Message-ID: <vNSdnVannoeY0AzfRVn-pw@speakeasy.net>
Frank Buss  <fb@frank-buss.de> wrote:
+---------------
| I want to transform my HTML pages to Lisp, because then I don't have to 
| write as much as with raw HTML, the compiler can check missing closing 
| tags, I can execute Lisp code for generating parts of the page etc. But I 
| don't want to use double-quotes for every text, because text is the 
| normal case. I hope this is possible with a reader-macro, perhaps it 
| could look like this:
| 
| #h ((head
|      (title "A Test"))
|     (body 
|      (p Just a (bold test).(br)
|         1 + 2 = (+ 1 2).(br)
|         And a link: (a :href "page.html" The Page).)))
+---------------

Search Google Groups for "Bradshaw Naggum TML" for a similar approach to
"quoteless" HTML-exprs. I think your example would be written thusly in TML:

    <html
      <head
	<title|A test>>
      <body
	<p|Just a <bold|test><br>
	   1 + 2 = <eval (+ 1 2)><br>
	   And a link: <a :href "page.html"|The Page>.>>>

[Or maybe "<lisp :eval (+ 1 2)>", I forget...]

[I'm also not sure of the exact rules on when the end-of-attributes
marker "|" can be omitted. I *think* it's whenever the next token
could not be taken as a Lisp symbol, but maybe it's only needed
before keywords. Tim?]


-Rob

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