Subject: Re: HTML reader macro
From: (Rob Warnock)
Date: Tue, 24 May 2005 19:27:13 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Frank Buss  <> wrote:
| Rob Warnock wrote:
| > 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>.>>>
| this looks good, if substituting "<" and ">" with "(" and ")",
| because then my editor does indention the right way.

No, no, no!  ;-}  ;-} The whole point is to use "<" & ">" so the
parenophobes don't get freaked out by seeing the source of your
documents. You know, "Parens bad; angles good. XML has angles. Yum."

Just teach your editor how to indent angles "the right way"...  ;-}

| But I don't know if it is a good idea to use double quotes for
| attributes, because for text it is not used.

Ahhhh, in the interest of brevity I neglected to mention a
critical point: Attributes and attribute values are PURE LISP
EXPRESSIONS, intended to be read with Common Lisp's READ and
evaluated by the TML processor. Yes, it's a bit weird to see
the quotes in the case of something as simple as this:

   <a :href "page.html"|The Page>

but more understandable [and the quotes *necessary*!] in more
complex cases:

   <a :href (concatenate 'string base-url "page.html")|The Page>

| On the other side it is a bit more natural, because in HTML attributes
| are enclosed in double quotes, too.

But as noted above, the actual reason has nothing to do with that.

| And I don't like the "eval", because I would like to define
| my own functions, which should be used like the rest, like
| "(footer :email "x@y.z")", which creates a user defined footer
| for a page and could be defined as a normal function.

You can certainly do that, given the addition of a a syntax for
defining functions. I think Tim added that [he called them "macros"]
in his DTML extension to TML. But IMHO you still need some sort of
all-purpose eval (by whatever name) that's a generic escape to Lisp.

| Perhpas it is more clear in the original documentation, but I didn't found
| much more information on Google Groups, only that Tim Bradshaw perhaps
| wanted to publish it, when it is ready. What I've found is this:
| but this doesn't look very complete (attributes and inline-Lisp is
| missing). Would be a good idea to take a closer look at the rules of the
| original system before re-inventing the wheel :-)

That's somebody else's work entirely, completely unrelated to
Tim Bradshaw's use of the acronuym "TML". See the news article
Stephan Ram quoted for Tim's version, which was designed to be
very simply parsable into HTOUT syntax [and then compiled by
the Lisp compiler]. That is, my example above:

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

translates directly into the following HTOUT s-expr [taking some
minor liberties on the "eval"]:

      (:head (:title "A test"))
	(:p "Just a " (:bold "test") :br (lfd)
	    "1 + 2 = " (fmt "~d" (+ 1 2)) :br (lfd)
	    "And a link: " ((:a :href "page.html") "The Page") ".")))

and produces the following output:

    <BODY><P>Just a <BOLD>test</BOLD><BR>
    1 + 2 = 3<BR>
    And a link: <A HREF='page.html'>The Page</A>.</P></BODY></HTML>


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607