This example is an scientific article written in Skribe. This example is pretty simple since it does not uses any introspection facilities. The outputs shows that with a single source file, it is possible to produce output files with different shapes. For this example, we have used the -p option that forces the Skribe engine to pre-loads a configuration file before processing a source file. The configuration files used for this example contain setting for the LNCS and ACMPROC Latex styles.

View demo...

article.skb
;*=====================================================================*/
;*    serrano/prgm/project/skribe/www/examples/article/article.skb     */
;*    -------------------------------------------------------------    */
;*    Author      :  Manuel Serrano                                    */
;*    Creation    :  Tue Oct 28 11:28:23 2003                          */
;*    Last change :  Wed Mar 10 05:48:28 2004 (serrano)                */
;*    Copyright   :  2003-04 Manuel Serrano                            */
;*    -------------------------------------------------------------    */
;*    An article in Skribe                                             */
;*=====================================================================*/
(skribe-load "web-article.skr" :css "article.css")

;*---------------------------------------------------------------------*/
;*    The document                                                     */
;*---------------------------------------------------------------------*/
(document :title "This is Skribe!"
   :author 
   (list 
    (author :name "Manuel Serrano"
       :affiliation "Inria Sophia-Antipolis"
       :address '("2004 route des Lucioles - BP 93"
                  "F-06902 Sophia Antipolis, Cedex"
                  "France")
       :email (tt (mailto "Manuel.Serrano@inria.fr"))
       :url (tt (ref :url "http://www.inria.fr/mimosa/Manuel.Serrano")))
    (author :name "Erick Gallesio"
       :affiliation "Université de Nice - Sophia Antipolis"
       :address '("930 route des Colles, BP 145"
                  "F-06903 Sophia Antipolis, Cedex"
                  "France")
       :email (tt (mailto "Erick.Gallesio@unice.fr"))
       :url (tt (ref :url "http://saxo.essi.fr/~gallesio"))))

;*---------------------------------------------------------------------*/
;*    bibliography                                                     */
;*---------------------------------------------------------------------*/
(bibliography :command "skribebibtex ~a" "skribe.bib")

;*---------------------------------------------------------------------*/
;*    abstract                                                         */
;*---------------------------------------------------------------------*/
(abstract :postscript (ref :url (tt (skribe-url)))
(paragraph [
This paper presents Skribe, a functional programming
language for authoring documents. Even if it is a general
purpose tool, it best suits the writing of technical
documents such as web pages or technical reports, API
documentations, etc.  Executing Skribe programs can
produce documents of various formats such as PostScript,
PDF, HTML, Texinfo or Unix man pages. That is, the very
same program can be used to produce documents in different
formats. Skribe is a full featured programming language
but it ,(emph "looks") like a markup language ,(emph "ŕ la")
HTML.
]))

;*---------------------------------------------------------------------*/
;*    introduction                                                     */
;*---------------------------------------------------------------------*/
(section :title "Introduction" (p [

Skribe is a functional programming language designed for authoring
documentations, such as web pages or technical reports. It is built 
on top of the Scheme programming language ,(ref :bib "scheme:r5rs"). Its 
concrete syntax is simple and it sounds familiar to anyone used to markup
languages. Authoring a document with Skribe is as simple as with
HTML or ,(LaTeX :space #f). It is even possible to use it without
noticing that it is a programming language because of the conciseness
of its original syntax: the ratio ,(emph "markup/text") is smaller
than with the other markup systems we have tested.])

(p [Executing a Skribe program with a Skribe evaluator produces
a target document. It can be HTML files that suit web browsers,
,(LaTeX) files for high-quality printed documents, or a set of ,(emph
"info") pages for on-line documentation.])

(p [Building purely static texts, that is texts avoiding
any kind of computation, is generally not sufficient for elaborated
documents. Frequently one needs to automatically produce parts of the
text. This ranges from very simple operations such as inserting in
a document the date of its last update or the number of its last
revision, to operations that work on the document itself.  For
instance, one may be willing to embed inside a text some statistics
about the document, such as the number of words, paragraphs
or sections it contains. Skribe is highly suitable for these
computations. A program is made of ,(emph "static texts")
(that is, ,(emph "constants") in the programming jargon) and various
functions that dynamically compute (when the Skribe program
runs) new texts. These functions are defined in the Scheme
programming language. The Skribe syntax
enables a sweet harmony between the static and dynamic components of a
program.])

(p [Authoring documents with a programming language is of course not a
novel idea, and a lot of systems have used this approach, such as
the ,(TeX :space #t) ,(ref :bib "knuth:tex86") typesetting system. 
PostScript ,(ref :bib "adobe:ps85") can also be
classified in this category. Even if it is not generally directly used
for authoring, it represents a document as a program whose execution
yields a set of printed pages.])

(p [On the other side, solutions based on the SGML ,(ref :bib
"golfarb:sgml91") or XML ,(ref :bib "hm:xml01") formats propose a model
where all the computations on a document are expressed outside of the
document itself. For instance, the DOM ,(ref :bib "w3c:dom98") approach 
extols a strict dichotomy between documents and programs. This dichotomy is 
presented as a virtue by its proponents, but it is our opinion that it makes
simple documents harder to code than with a general linguistic tool
because it requires the usage of several different languages with
different semantics and different syntax.])

(p [With the development of dynamic content web sites, a great number
of intermediate solutions based on programming languages have been
proposed. These solutions generally consist in giving a way to embed
calls to a programming language inside a document. PHP ,(ref :bib
"lerdof:php00") is probably the most representative of this
kind. A document is a mix of text and code expressed with
different syntaxes. This implies that the author/programmer must deal
at the very same time with the underlying text markup system as well
as the programming language. Furthermore, these tools do not permit to
reify a document structure and are generally limited to the
production of web pages only.])

(p [The approach we propose is inspired by the LAML system ,(ref :bib
"normark:sigplan99") which uses Scheme as a markup language. In LAML
as in Skribe, a document is a program and its evaluation
yields its final form.  Both languages permit the user to
typeset documents using an ,(emph "unique") syntax. However, LAML
is limited to the production of HTML, whereas, as said before, the
evaluation of a Skribe program can produce several output
formats.]))

;*---------------------------------------------------------------------*/
;*    references                                                       */
;*---------------------------------------------------------------------*/
(references))

Last update Wed Jun 30 08:26:02 2010.