For Programmers: Free Programming Magazines  


Home > Archive > Lisp > May 2005 > HTML reader macro









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTML reader macro
Frank Buss

2005-05-28, 8:57 pm

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).)))

If the first word is a known HTML tag, then the next words are
interpreted as ":key value" pairs for HTML attributes and the rest is
text. If the first word is not a HTML tag, it is evaluated as a Lisp
form. The result:

<html>
<head>
<title>A Test</title>
</head>
<body>
<p>
Just a <b>test</b>.<br>
1 + 2 = 3.<br>
And a link: <a href="page.html">The Page</a>.
</p>
</body>
</html>

Do you think this is a good idea? How do I implement it? Normally all
characters are changed to uppercase with read.

--
Frank Buß, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com