Kurt Nørmark ©
Department of Computer Science
Aalborg University
Denmark
Abstract Index References Contents | These slides and the associated comments reflect my talk on the LAML approach. The talk is given at the Lisp User Group Meeting in Amsterdam, June 1999. |
Background Slide Note Contents Index References | I start with my original need for Lisp in the domain of Internet programming. This was not authoring of static WWW pages, but CGI programming in a better language than Perl |
|
|
|
CGI Programming Slide Note Contents Index References | In order to explore the nature of CGI programming we here take a closer look at the overall CGI scheme |
Figure. The interaction between a browser and a CGI program |
|
CGI Programming with Program State Slide Note Contents Index References | In many CGI programs we need to store a 'program state'. Often, data is transferred to and from a database. We modify the previous picture in include this observation. |
Figure. The interaction between a browser and a CGI program, which uses a database for storing the program state |
|
CGI Programming in Scheme Slide Note Contents Index References | We now return to CGI programming in Scheme. |
|
|
This conclusion is drawn from a variety of different examples, which we have implemented. Most of the examples have been used to support various aspects of 'Open University' students located off campus. |
|
Programming static WWW pages in Scheme Slide Note Contents Index References | We will now return to the main topic of this talk, namely programming of ordinary, static WWW pages. |
|
We will return to both abstraction and automation later in the presentation. |
This observation is in relation to abstraction. XML supports 'your own' domain-specific tags. However, in relation to automation of routine tasks, XML has nothing to offer. |
LAML: Lisp Abstracted Markup Language Slide Note Contents Index References | We now introduce LAML, which basically is Scheme with access to libraries which mirror HTML. In addition, we support a number of functions which in our experience are very helpful during a typical WWW authoring process. Some of these functions are organized in document styles. |
|
|
An LAML Document Example Slide Note Contents Index References | It is now time to study a concrete example of an LAML document |
Program: We see a simple WWW pages written in LAML. The first interesting thing is the function generic-page-1, which
generates all the html, body and title stuff, which is found on any WWW pages written in HTML.
The con-par function is just a string-append variant, which concatenates paragraphs of text.
The functions em and b mirror the similar HTML tags.
The table-1 function is one of our convenient abstractions of HTML tables. We make a three column table with
given widths, and a border of 2 pixels. The table proper is defined by a list of table rows. Each row is itself a list.
The make-color function makes a color from red, green, blue components.
| (load (string-append laml-dir "laml.scm")) (laml-style "simple") (generic-page-1 "A simple page" (con-par "This page demonstrates a few of the functions in the HTML library." (em (con-space "This paragraph has been emphasized by means of the" (b "em") "function.")) "Let us also show a simple table, which is one of the real convenient elements in LAML:" (table-1 2 ; border (list 100 200 100) (list red green blue) (list (list "Here" "is" "some") (list "tabular" "text" ""))) (b "This ends this simple page")) (make-color 255 255 191) black blue blue ) (end-laml) |
|
Syntactic LAML issues Slide Note Contents Index References | The example from above raises a number of relevant syntactic issues, which we will discuss here and on the next page |
|
Syntax: We show the syntax of a tag application f on some text. The tag application passes the attributes a1 and a2 with given values |
|
Figure. A table shown four possible parameter profiles of HTML mirror functions in Scheme. We use the third possibility in our libraries and in our examples |
|
Semi constant strings in Scheme Slide Note Contents Index References | When we compare an SGML family language with a Lisp family programming language we find some major syntactical differences. The observation about semi-constant strings is one of the most important |
|
Program: This is a typical HTML/XML fragment | <point> A text with a <a href="subsection/sec1.html">link</a> to a <b>subsection</b> </point> |
Program: Here we attempt to use a semi-constant string in Scheme. This does actually not make sense. | (point "A text with a (a "link" 'href "subsection/sec.html") to a (b "subsection") ") |
Program: Here we see the solution we use in all our examples. This uses a plain Scheme programming approach. | (point (string-append "A text with a " (a "link" 'href "subsection/sec.html") " to a " (b "subsection"))) |
|
Abstractions in LAML Slide Note Contents Index References | We now return to one of the main points of the talk, namely how to take advantage of abstraction in an LAML document. Notices that similar things can be done in XML. |
|
Program: A complete LAML WWW page. We have introduced a number of 'ad hoc' abstractions, the
implementation of which is shown below.
| (load (string-append laml-dir "laml.scm")) (style "simple") (load (string-append (startup-directory scheme-system) "functions.scm")) (generic-page-1 "Demonstration of abstractions" (con (standard-intro "My FAQ") (ul (map present-faq-entry (list (faq-entry 'teacher "What is Lisp" "Lisp is a list processing language...") (faq-entry 'student "What is LAML" "LAML is Scheme in which HTML is mirrored...") (faq-entry 'student "What is the main differences between Scheme and Lisp" "Scheme is a relatively small, but powerful Lisp dialect...") ))) (standard-signature) ) white black blue blue ) |
|
Program: The implementation of the abstractions.
|
|
URL abstraction Slide Note Contents Index References | We will here mention a very useful area of abstraction, namely the possibility to abstracts from part of the details in an URL |
|
|
|
Overview of LAML styles Slide Note Contents Index References | An LAML style represents a collection of related abstractions, which supports authoring of documents in a particular domain. This page gives an overview of existing document styles in LAML |
|
|
Example of the manual document style Slide Note Contents Index References | The manual styles is oriented towards documentation of the external and programmatic aspect of a Scheme program |
|
Program: This shows an excerpt of a typical manual style LAML document.
Actually, the excerpt is taken from the manual which document the manual facility itself.
This is a little circular, but quite realistic. Using the nearby cross reference you can see
the resulting WWW page | ; Top level functions (manual-section (section-title "Top level functions") (section-body "The important top level functions are manual-page and manual-section. These are the most important functions from a manual writer's perspective.")) (manual-page 'manual-page (title "manual-page") (form '(manual-page id . elements)) (description "Defines a manual entry.") (parameters (parameter "id" "A symbol identifying the manual page") (parameter "elements" "Zero, one or more title, form, pre-condition, description, parameters, example, or misc elements") ) ) (manual-page 'manual-section (title "manual-section") (form '(manual-section . element)) (description "Defines a new section of a manual. The only forms allowed within a manual section are manual-title and manual-body") (parameters (parameter "elements" "a list of manual-title and manual-body forms") ) ) ; End top level functions |
|
Example of the lecture note document style Slide Note Contents Index References | On this page we show an example of the most substantial LAML document style developed to date. It is called LENO: A lecture note style. The slides you are looking at right now are written in LENO. Therefore we show the underlying LENO source of this page to illustrate our approach. |
|
Program: This is the LAML expression which generates the current slide.
You can easily recognize the point clauses above and below. The
source-program clause inserts the large middle LAML document excerpt. | (note-page 'leno-ex (title "Example of the lecture note document style" "On this page we show an example of the most substantial LAML document style developed to date. It is called LENO: A lecture note style. The slides you are looking at right now are written in LENO. Therefore we show the underlying LENO source of this page to illustrate our approach." ) (point "These slides are written in LAML by means of the lecture note style" "" ) (source-program "lugm-99.laml" (list "(note-page 'leno-ex" demo-end-mark) (list (list "note-page" "" level-1-color 'bold) (list "title" "" level-2-color 'bold) (list point-form "" level-2-color 'bold 2) (list "source-program" "" level-2-color 'bold) (list index-word-form "" level-2-color 'bold) ) (list 'slide-inline 'book-inline) "This is the LAML expression which generates the current slide. You can easily recognize the point clauses above and below. The source-program clause inserts the large middle LAML document excerpt." ) (point "The program excerpt above is taken directly from the LAML source of these slides" "" ) (index-words "LENO" "Lecture note style (example of)") ) ; end leno-ex |
|
Example of the Elucidator document style Slide Note Contents Index References | As the last LAML document style we take a look at the Scheme Elucidator style. |
|
|
|
Automation with LAML Slide Note Contents Index References | We now turn to the other main point of the LAML approach. This is the possibility to automate routine tasks in the authoring process via programmed solutions. |
|
|
|
Insertion of quotations from external files Slide Note Contents Index References | Here we illustrate how to insert excerpts from external files into a note page (a slide). We have used this facility several times in this set of slides already presented |
|
Program: The application of the Scheme functions which returns a selected part of an external file | (read-text-file-between-marks file-path mark) |
Program: A variant of the function shown above which includes the marks in the extracted text string | (read-text-file-including-marks file-name start-mark end-mark) |
Program: Additional superimposition of colors and fonts, as specified by font-and-color-specification | (colorize-substrings (read-text-file-between-marks file-path mark) font-and-color-specification) |
|
An example of an LAML tool: SchemeDoc Slide Note Contents Index References | We illustrate the ideal of an LAML with the SchemeDoc tool. This tool is inspired from JavaDoc and similar tools. |
|
|
Figure. This figure illustrates the process implemented by the SchemeDoc tool. The main idea is to translate the lexical Lisp comments to syntactic elements. Given this, it is easy to parse the translated program and to extract the relevant comments |
An Emacs-based LAML environment Slide Note Contents Index References | We here briefly discuss an LAML environment in which the Emacs text editor plays an important role |
|
|
|
Conclusions: The LAML approach Slide Note Contents Index References | An finally the conclusions based on or LAML work until now |
|
|
Source files in this lecture Contents Index References | ../../examples/simple-pages/simple-page-1.laml includes/abstraction-demo.laml includes/functions.scm ../../styles/manual/man/manual.laml lugm-99.laml includes/quote-1 includes/quote-3 includes/quote-2 |
Using Lisp as a Markup Language
The LAML approach
Course home Author home About producing this web Previous lecture (top) Next lecture (top) Previous lecture (bund) Next lecture (bund)
Generated: March 26, 2002, 12:32:16