LAML |
LAML means 'Lisp Abstracted Markup Language'. LAML is a software package written by the author of this material. The purpose of LAML is to support web development in Scheme - both of static materials and of server-side applications.
In the first and the main part of this material we have used LAML whenever possible, to illustrate functional programming in Scheme with examples from the web domain. We are now ready for a more solid introduction and description of LAML.
26.1 HTML documents in LAML | 26.3 Programmatic authoring |
26.2 Authoring of web materials | 26.4 LAML: Lisp Abstracted Markup Language |
26.1. HTML documents in LAML
Contents Up Previous Next Slide Subject index Program index Exercise index
We start gently by taking a look at a very simple HTML document - see Program 26.1.
The document in Program 26.1 can be accessed via [initdoc].
We introduce LAML by studying the LAML counterpart of a very simple HTML document |
1 2 3 4 5 6 7 8 9 10 11 12 | <html> <head> <title>This is the document title</title> </head> <body> <h1>Document title</h1> <p>Here is the first paragraph of the document</p> <p>The second paragraph has an <em>emphasized item</em> and a <b>bold face item</b>. </p> </body> </html> | |||
|
The LAML counterpart of Program 26.1 is shown in Program 26.2. Each HTML element instance used in Program 26.1 is available in Scheme as a function. The set of such functions are called a mirror of HTML in Scheme. In Chapter 27 we will study the HTML mirror functions in details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | (html (head (title "This is the document title") ) (body (h1 "Document title") (p "Here is the first paragraph of the document") (p "The second paragraph has an" (em "emphasized item") "and a" (b "bold face item") _ ".") ) ) | |||
|
The final document on this page, Program 26.3, shows a complete LAML document. The red parts of the program make up the differences between Program 26.2 and Program 26.3. The first two lines of the red parts load the necessary software. The write-html clause renders the HTML document to text, and it writes the HTML document to a file in the file system.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | (load (string-append laml-dir "laml.scm")) (style "simple-html4.01-transitional-validating") (write-html '(raw prolog epilog) (html (head (title "This is the document title") ) (body (h1 "Document title") (p "Here is the first paragraph of the document") (p "The second paragraph has an" (em "emphasized item") "and a" (b "bold face item")_".") ) ) ) | |||
|
The document generated by Program 26.3 can be accessed via [lamldoc].
26.2. Authoring of web materials
Contents Up Previous Next Slide Subject index Program index Exercise index
We leave the HTML mirror functions temporarily. We come back to them in Chapter 27. Here we will give an overview of ways to produce web materials. Our main purpose with this section is to put our approach - programmatic authoring - in perspective and in relation to more well-known and more commonly used techniques.
Several different approaches to web authoring can be identified |
|
In the next section we define and describe the last approach - programmatic authoring - in more details.
26.3. Programmatic authoring
Contents Up Previous Next Slide Subject index Program index Exercise index
Programmatic authoring is the idea behind the use of LAML for creation of static web pages.
|
The generation of HTML upon execution of a programmatically authored document can be questioned. It can be argued that several possible kinds of processings and transformation can be imagined. Why bind the program execution to a single kind of processing?
In LAML we have more recently prepared for an intermediate document representation, which is produced when a document is processed. This is part of the XML-in-LAML approach, which we touch on in Section 28.4. This document representation is akin to abstract syntax trees. Thus, when evaluating an expression such as the one in Program 26.2 in a context where all the mirror functions and defined, an abstract syntax is returned. This intermediate representation can be rendered as textual HTML, or it can be processed in another direction.
|
Using programmatic authoring the power of a programming language is available everywhere in the document,
and at any time in the authoring process |
26.4. LAML: Lisp Abstracted Markup Language
Contents Up Previous Next Slide Subject index Program index Exercise index
|
|
Briefly stated, but also somewhat simplified, we can summarize LAML as follows.
LAML = Scheme + The HTML and XML mirrors |
26.5. References
[Initdoc] | The initial HTML document as rendered in a browser http://people.cs.aau.dk/~normark/prog3-03/html/notes/external-html/initial-document.html |
[Lamldoc] | The LAML generated document as rendered in a browser http://people.cs.aau.dk/~normark/prog3-03/html/notes/external-html/doc1.html |