No Latte Interpreter

Writing raw HTML is really, really annoying:

  • maintaining balanced tags... <em><strong>problem!</em></strong>
  • worrying about paragraph tags... <p>Paragraph</p>
  • using entity encodings... &amp; and &lt;
  • lots of repetition... any website template

HTML was never supposed to be something that you would see... it staggers me that people have actually put up with having to write HTML by hand.

-- Tim Berners-Lee, inventor of HTML, Technology Review July 1996

Latte solved these problems (at least for me). It provided a Scheme-like syntax (and semantics) with some LaTeX ideas. So...

  • tags are automatically balanced... {\em {\strong no problem!}}
  • paragraph tags are added for you... Paragraph becomes <p>Paragraph</p>
  • entities are automatically encoded... & and < become &amp; and &lt;
  • abstract to your hearts content... {\my-page content}

But then Latte dried up. So for a variety of reasons, I wrote my own version of the interpreter (mostly compatible with the last version of Latte).

The Four Pillars

Balanced Tags

The syntax of No Latte is based on LISP and Scheme. While many complain about the many parentheses in these languages, those parentheses are still much easier to deal with that the end tags of HTML. So a simple webpage might look like this:

{\head
  {\title Title of the page}
  }
{\body
  {\h1 Header One}
  Content.
  }

Notice how each (implied) end tags is closed with a single curly brace.

Paragraph Tags

In the example above, Content. appears in a <body> tag. The paragraph inserter knows enough to place paragraph tags around this text, <p>Content.</p>. It does not put paragraph tags around Header One because it's within a <h1> tag.

Entity Encodings

Just type in the characters that you want, and the No Latte interpreter will turn the necessary characters into the proper entity encodings. i >= 0 && i <= 5 becomes i &gt;= o &amp;&amp; i &lt;= 5.

Abstraction

Defined fuctions:

{\def \my-page
  {\lambda {\page-title \&content}
    {\group
      {\head
        {\title \page-title}
        }
      {\body \content}
      }
    }
  }
{\my-page {The Title}
  {\h1 Header One}
  Content.
  }

Sure, it's a lot of heavy lifting to get started, but consider that my-page can be reused millions of times now...


Creative Commons License © 2007. Developer and website author: Jeremy D. Frens
This website is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License