Using Lisp as a Markup Language
The LAML approach
Slide updates

Kurt Nørmark ©
Department of Computer Science
Aalborg University
Denmark


Abstract

Index References Contents
These slides are follow up slides to the LUGM talk
HTML mirroring
Slide Note Contents Index References

HTML is mirrored as functions in Scheme on an element by element basis

  • Three generation of HTML mirroring

    • Ad hoc mirroring

      • Manual programming of 'tags' when needed

    • Simple generic mirroring

      • The HTML mirror is generated on the basis of lists of single of double tags

      • If you have made one mirror function you have made them all

    • Accurate and systematic mirroring

      • Based on a parsed representation of the HTML4.0 DTD

      • Accurate handling of attributes (but no validation)

      • Three layers: basis, surface, convenience

References

An example of a simple HTML4.0 page
Slide Note Contents Index References

Below we show a simple page using the HTML4.0 accurate mirror in Scheme

Program: An LAML document using the most advanced mirror. The loading stuff can be seen by browsing to the program below
(load "html4-loading-stuff.scm")

(define _ #f)

(html-write
 (html
  (head 
    (title "Here is the title")
  )

  (body 
    (h1 "A header")

      "Here comes the" (em "document text") _ ", with an " (b "enumeration") _ "."  (p)

      (ul 'type "square"
        (li "Item 1" _ ";")
        (li "Item 2" _ ";") 
        (li "Item 3" _ ".") 
      )

    (a 'href "../html/lugm99.html" "A link to the table of contents") _ "." (br)

    "And finally some more " (kbd "text")_"."
  )
 )
)

Program: The loading stuff used by the LAML example above.
(load (string-append laml-dir "laml.scm"))

(lib-load "html4.0-loose/basis.scm")
(lib-load "html4.0-loose/surface.scm")

(lib-load "file-read.scm")

(define (html-write html-string)
  (write-text-file
    html-string
    (string-append 
      (startup-directory) (source-filename-without-extension) "." "html")))

 

Reference

Concluding remarks
Slide Note Contents Index References

The source of a WWW document is a program in Scheme

A functional programming language is much better for our purposes than an imperative programming language

Modern functional programming languages would push on the type system in order to ensure grammatical correctness

In the Lisp world flexibility and pragmatic solutions are more important


Collected references
Contents Index
The HTML4.0 loose accurate mirror - surface
The HTML4.0 loose accurate mirror - basis
The HTML simple generic mirror
The HTML Ad hoc mirror
The resulting HTML page


Source files in this lecture
Contents Index References
includes/html4-demo.laml
includes/html4-loading-stuff.scm

 

Chapter false: Using Lisp as a Markup Language
The LAML approach
Slide updates

Course home     Author home     About producing this web     Previous lecture (top)     Next lecture (top)     Previous lecture (bund)     Next lecture (bund)     
Generated: 20.12.1999, 09:13:08