Programmatic WWW authoringKurt Nørmark ©
Department of Computer Science, Aalborg University,
Denmark
Figure. The location of Denmark in Europe | | |
Figure. The location of Aalborg in Denmark | | |
| | - Programmatic authoring of static documents
- Derivation of a set of HTML documents from a single document source
- Authoring of complex material
- Material in several versions
- Comprehensive linking
- Multiple overlapping views
|
|
| | LAML is also oriented towards server dynamic pages calculated at document access time |
|
| | - Document source language
- Program execution
- Generates the underlying HTML pages
- Abstraction
- Document details can be encapsulated in functions
- Automation
- Routine tasks can be programmed in procedures
|
|
| | Authoring of complex web materials involves the same problems and solutions as development of non-trivial software |
|
Program: A very simple HTML document.
| | <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>
|
|
Program: The LAML counterpart.
| | (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")_".")
))
)
|
|
Program: An extended LAML counterpart.
| | (load (string-append laml-dir "laml.scm"))
(style "simple-html4.01-transitional-validating")
(define (normark-url suffix)
(string-append "http://www.cs.auc.dk/~normark/" suffix))
(define complex (even? (current-time)))
(write-html '(raw prolog epilog)
(html
(head
(title "This is the document title")
)
(body
(h1 "Document title")
(if complex
(p "A first paragraph with a link to"
(a 'href (normark-url "laml/") "LAML"))
(p "Here is the first paragraph of the document"))
(if complex
(p "The second paragraph has a link to"
(a 'href (normark-url "scheme/") "the LAML software"))
(p "The second paragraph has an" (em "emphasized item")
"and a" (b "bold face item")_"."))
(kn)
)
)
)
|
|
| | Attributes are handled by simulated keyword parameters Textual content is passed as quoted strings There is white space between content strings unless explicitly suppressed |
|
Program: An illustration of the most basic mirror rules of LAML.
| | (a 'href "http:www11.org" 'target "main" "A link to" "WWW2002") |
|
Program: The HTML counterpart.
| | <a href = "http:www11.org" target = "main">A link to WWW2002</a> |
|
| | Instead of specifying where to add white space we tell where to suppress it |
|
Program: Illustration of white space suppression.
| | (p "Use" (kbd "HTML") _ "," (kbd "XHTML") _ ","
(kbd "XML") _ "," "or" (kbd "LAML") _ ".") |
|
Program: The HTML counterpart.
| | <p>
Use <kbd>HTML</kbd>, <kbd>XHTML</kbd>,
<kbd>XML</kbd>, or <kbd>LAML</kbd>.
</p> |
|
| | Lists of contents and lists of attributes are processed recursively and spliced together with their context |
|
Program: Passing of attribute lists and lists of textual contents.
| | (body
(ul
(map li (list "one" "two" "three")))
(let ((attributes (list 'start "3"))
(contents (map li (list "one" "two" "three"))))
(ol 'id "demo" contents attributes)))
)
)
|
|
Program: The HTML counterpart.
| | <body>
<ul><li>one</li> <li>two</li> <li>three</li></ul>
<ol id="demo" start="3"><li>one</li> <li>two</li> <li>three</li></ol>
</body> |
|
| | CSS attributes and HTML attributes are uniformly specified CSS attributes are prefixed with css: |
|
Program: Using CSS attributes together with HTML attributes.
| | (em 'class "c1" 'css:background-color "yellow" "WWW2002") |
|
Program: The HTML counterpart.
| | <em class = "c1" style = "background-color: yellow;">WWW2002</em> |
|
| | An HTML mirror is automatically derived from a DTD |
|
| | - Well-formed and valid documents
- Guaranties generation of well-formed and valid HTML documents
- Structural document representation
- The mirror functions return abstract syntax trees which can be rendered as 'HTML text'
- HTML layout
- Supports optional pretty printing of the resulting HTML code
- Convenient rendering of reserved HTML characters
- '<' and '>' are rendered as the corresponding character entities
|
|
| | LAML supports a number of domain specific languages called document styles |
|
| | - From a set of abstractions to a language
- A coherent set of functions can be considered as a new language
- Examples
- Software manuals, questionnaires, lecture notes, course home pages, scientific papers
- Example in the paper
|
|
| | It is attractive to bring the document styles as close as possible to XML |
|
| | It is attractive to mirror XML languages in Scheme along the same lines as HTML |
|
| | - Derived from a DTD
- An XML mirror in Scheme can be produced almost automatically from a DTD
- Validating
- The mirror functions do full document validation 'on the fly'
- Name spaces
- Prepared to deal with overlapping name spaces at the Scheme level
- Action procedures
- Selected XML elements can be specified to initiate
an action (transformation)
|
|
LENO: An XML-in-LAML example language Slide Note Contents Index References | | We here give an example of an XML-in-LAML language including a
study of the concrete document representation |
| | The document source of these slides is
written in an XML-in-LAML language called LENO |
|
| | - Produces complex material
- Heavily interlinked pages with multiple views of the materials
- Multiple author interfaces
- LENO supports both an original primitive Scheme interface,
XML-in-LAML, and XML
- Relatively mature
- We have used LENO to produce E-learning material
the last four years
|
For this presentation we have used the XML-in-LAML interface. |
Program: The LAML document source of this page.
| | (note-page 'id "xmlinlaml-leno"
(title
(main-text
"LENO: An XML-in-LAML example language"
)
(annotation
"We here give an example of an XML-in-LAML language including a
study of the concrete document representation"
)
)
(point 'margin-top "4em"
(main-text
"The document source of these slides is
written in an XML-in-LAML language called LENO"
)
)
(items 'margin-bottom "4em"
(item
(main-text (b "Produces complex material")
)
(items
(item
(main-text "Heavily interlinked pages with multiple views of the materials"
))))
(item
(main-text (b "Multiple author interfaces")
)
(items
(item
(main-text "LENO supports both an original primitive Scheme interface,
XML-in-LAML, and XML")
(annotation "For this presentation we have used the XML-in-LAML interface.")
)))
(item
(main-text (b "Relatively mature")
)
(items
(item
(main-text "We have used LENO to produce E-learning material
the last four years"
)))))
(source-program
'src "www2002.laml"
'from-mark "(note-page 'id \"xmlinlaml-leno\""
'to-mark demo-end-mark
'slide-mode "external"
'book-mode "inline"
(color-decorations
(color-decoration 'from-mark "note-page" 'to-mark "" 'color "red" 'face "bold" )
(color-decoration 'from-mark "title" 'to-mark "" 'color "blue" 'face "bold" )
(color-decoration 'from-mark "point" 'to-mark "" 'color "blue" 'face "bold" 'repetition "1")
(color-decoration 'from-mark "items" 'to-mark "" 'color "blue" 'face "bold" 'repetition "4")
(color-decoration 'from-mark "source-program" 'to-mark "" 'color "blue" 'face "bold" )
(color-decoration 'from-mark "item " 'to-mark "" 'color "brown" 'face "bold" 'repetition "6")
(color-decoration 'from-mark "main-text" 'to-mark "" 'color "brown" 'face "bold" 'repetition "10")
(color-decoration 'from-mark "annotation" 'to-mark "" 'color "brown" 'face "bold" 'repetition "2")
)
(main-text
"The LAML document source of this page" )
)
) ; end xml-in-laml |
|
Reflections and conclusions | | |
| | - The programming paradigm
- Good fit between functional programming and descriptive markup
- Similar work is well-represented in the functional programming communities
- Imperative programming is less attractive in a programmatic authoring context
- Mixing fragments of markup and programs
- Less powerful than a solution that involves a single linguistic framework
- Aesthetically unpleasing
|
|
| | We have gone for inclusion of the less powerful language in the more powerful language |
|
| | - LAML usage
- I have used LAML for all my generated documents and all server-side programs the last four years
- LAML has been downloaded numerous times and used at least for educational purposes
- The programming language Scheme
- A Lisp language can deliver the necessary flexibility and power for support of programmatic authoring
|
|
| | LAML is available as free software from the LAML home page at http://www.cs.auc.dk/~normark/laml/ |
|
Programmatic WWW authoring
Course home Author home About producing this web Previous lecture (top) Next lecture (top) Previous lecture (bund) Next lecture (bund)
Generated: June 24, 2004, 12:43:16