Theme index -- Keyboard shortcut: 'u'  Previous theme in this lecture -- Keyboard shortcut: 'p'  Next slide in this lecture -- Keyboard shortcut: 'n'LAML
28.  Additional LAML topics

In this chapter we describe some more practical aspects of using LAML. We also touch on the XML-in-LAML approach.

28.1 LAML document processing28.4 XML in LAML
28.2 LAML document styles and tools28.5 More information
28.3 LAML server-side programming - CGI
 

28.1.  LAML document processing
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

As one of the underlying ideas of LAML, we organize the programmatic source of a web document as a Scheme program. When the Scheme program is executed, the underlying HTML files are generated.

It is of practical importance to make it easy and flexible to execute the Scheme program. Below we summarize the possibilities supported in the LAML system.

The LAML system supports a number of different ways to process a document

  • From the command prompt (shell)

    • Good for some Unix users

    • Good for tool composition - piping

  • From a Scheme prompt (LAML prompt)

    • Makes it possible to interact with LAML at a more fine grained level

  • From Emacs

    • Direct support of LAML from an advanced text editor

    • Synchronous and asynchronous processing

    • Keyboard shortcuts, templates, and menu support

    • Support of embedding of a substring in a Lisp form - and the inverse unembedding

Let us be more concrete. Scheme source files with LAML documents are supposed to have the file extension 'laml'. We will assume that we have written source document in a file called 'd.laml'.

From a command prompt or a Unix shell, you can execute it and hereby generate the underlying HTML file by the command laml d.

From a Scheme interpreter (a Scheme prompt) in which the basic LAML software has been loaded, you can type (laml "d") followed by "enter". This is a call of the laml procedure on "d".

From within Emacs (in which the LAML mode has been loaded) you can process a the document directly, by issuing the command M-x laml-process-current-buffer. (It is assumed, however, that the buffer is associated with a file at some location in the file system). The emacs command laml-process-current-buffer is bound to some convenient shortcut, C-o, which makes it very easy to do the processing.

In Emacs, it is possible to start an interactive Scheme/LAML session. This is done with M-x run-laml-interactively. Using this possibility, the Scheme system is started, and selected LAML libraries are loaded. The Emacs Lisp variables interactive-laml-mirror-library and interactive-laml-load-convenience-library control which HTML mirror library and which additional support libraries to load in the interactive LAML session.

The Emacs support of LAML can be seen as powerful environment for programmatic authoring

As a practical remark, we will strongly recommend that LAML is used via Emacs. Authors of LAML-based materials should make use the features of the Emacs laml mode. Similarly, users who interact with the Scheme system can make good use of the additional support in Emacs, such as the run-laml-interactively command mentioned above, and the variables that control the behavior of this command.

 

28.2.  LAML document styles and tools
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

The purpose of this section is to give a short overview of some of the major document styles and tools in LAML. A document style is a LAML based language. All such new languages are derived from an XML document type definition.

The overview below is by no means comprehensive. You are referred to the LAML Software home page [normark02e] for details.

A number of document styles and tools have been built on top of the basic LAML libraries and the mirrors

  • Document styles

    • Domain specific web languages

    • LENO in which this material is written

    • Course plan in which the course home page is written

    • The Manual document style in which the LAML software is documented

    • ...

  • Tools

    • The Scheme Elucidator used to explain programs in this material

    • Web Calendar used on the course home page

    • XML parser and XML mirror generation tool

    • ...

 

28.3.  LAML server-side programming - CGI
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

LAML can be used for authoring of static web material using a Scheme mirror of an XML language. LAML has also been used for server side programming using the Common Gateway Interface - CGI.

In this material we will not cover CGI programming in Scheme, but we will refer to an elucidative tutorial on the topic.

Go to elucidatorAn example of CGI Programming in Scheme with LAML

A number of non-trivial server side web systems have been made in LAML via use of CGI

  • LAML Web System

    • IDAFUS - a distance education manager used for CS open university activities during three years

    • The calendar manager

    • The exercise manager

    • ...

IDAFUS - Insitut for DAtalogis FjernUndervisnings System - is a major example of a LAML server application used for non-trivial purposes during a number of years in open university educations. The exercise manager is a minor system for synchronous management of exercise sessions. It requires user name and password to try out these systems.

The LAML calendar manager is widely used at Aalborg University for course and semester calendar management. The author's (simple) calendar can be accessed as an example [kn-calendar]. From a given calendar you can create your own, if you want.

 

28.4.  XML in LAML
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

XML-in-LAML is the LAML framework for mirroring of XML languages in Scheme.

In LAML there is a DTD parser, which produces a Lisp representation of a DTD. Based on this representation it is possible to synthesize an exact Scheme mirror of the XML language. The properties of this mirror is described below.

XML-in-LAML is a mirroring technique that makes XML languages available in Scheme

  • XML-in-LAML

    • Mirror derivation from Document Type Definitions (DTDs)

    • Automatic derivation of validation predicates

    • Two or more XML languages can co-exist

  • Existing XML-in-LAML languages

    • XHTML (strict, transitional, frameset) with full validation

    • SVG - Scalable Vector Graphics - with partial validation

    • LENO - the XML language used as the source of this material - with full validation

    • Course Plan - the course home page system.

    • Program Dissection - A simple program explanation facility

    • Photo Show - A web photo presentation system

Currently we convert several existing LAML document styles to the XML-in-LAML framework. As an important language for this material - LENO has already been transformed.

 

28.5.  More information
Contents   Up Previous Next   Slide    Subject index Program index Exercise index 

There are a number of sources to more information about LAML

  • Academic

    • The papers available from the LAML Home Page

  • Tutorial

    • The elucidative LAML Tutorial

  • LAML user/programmer information

    • The LAML software home page

The LAML home page [laml-home] contains all the papers that have been written above LAML and LENO.

The aim of the LAML tutorial [laml-tutorial] is to introduce various aspects of LAML in a gentle way.

The LAML software home page [laml-software] contains an overview of all the software, and it gives access to a download page where the latest distribution is made available as free software.

LAML can be downloaded as free software from the LAML home page

The exercise below is seen as a typical, practically oriented example where LAML can be used for management of everyday information.


Exercise 7.1. Bookmark administration

Exercise motivation: It is not practical to bind web bookmarks to a single machine nor to a single browser. Therefore we will maintain a list of bookmark entries in a file, and generate web bookmark pages from this description.

We will assume that we maintain a list of bookmark entries, each of the form

(bookmark URL title category comment)

The first constituent is a symbol (a tag that distinguishes bookmark entries from other structured data) and the other fields are text strings.

You can find an example of a bookmark list here. See the link in the web version.

The exercise is to complete a frame-based bookmark browser, given a list of bookmarks.You can find an example of a frame-based bookmark browser here. See again the link in the web version. To make it realistic for you to solve this exercises, you are only asked to make the left frame: the category overview frame. The frameset page and the right frame page are already programmed.

You are, however, supposed to understand the pre-programmed frame of the exercise. So start to read through the existing pieces of the program.

You can find the pre-programmed part of the bookmark browser in the zip file bookmarks-zip.zip. Please consult the web version of the material to get access to it. Unzip it, and LAML process the file bookmark.laml. Bring up the file bookmark-frameset.html in a browser to get started.

You are welcome to extend the solution, for example with a good use of the comment field from the bookmark entry.

There is no solution to this exercise


 

28.6.  References
[Normark02e]Kurt NÝrmark, "The LAML Software Home Page", 2002-2003.
[Kn-calendar]The authors personal LAML calendar
http://www.cs.auc.dk/~normark/cgi-bin/calendar/data/normark.html
[Laml-cgi-tutorial]Guess a Number - A simple CGI program in Scheme with LAML
http://www.cs.auc.dk/~normark/scheme/tutorial/cgi-programming/cgi-programming.html
[Laml-home]The LAML home page
http://www.cs.auc.dk/~normark/laml/
[Laml-tutorial]The LAML tutorial
http://www.cs.auc.dk/~normark/scheme/tutorial/index.html
[Laml-software]The LAML software home page - development version
http://www.cs.auc.dk/~normark/scheme/index.html

Generated: Tuesday July 2, 2013, 09:16:05
Theme index -- Keyboard shortcut: 'u'  Previous theme in this lecture -- Keyboard shortcut: 'p'  Next slide in this lecture -- Keyboard shortcut: 'n'