Scheme Scribe homepage -- Examples

Scheme Scribe homepage -- Examples

Table of contents

Scheme Scribe homepage
  News
  Download
  Mailing list
  License
  ChangeLog
  Examples
    scribe.scr
    changelog.scr

Documentation

White paper

User manual
Advanced manual
Scribe styles




If you have any comments on this web page or if you have a contribution or an application that you would like pointed to by this web page, please contact the maintainer of the page.

This web site is implemented by the means of two Scribe sources. So, this web site can servers as an example of Scribe document. We start presenting the main file scribe.scr and then the second source, changelog.scr, used to implement the ChangeLog section. For the curious ones, check in the first source file the implementation of this meta-chapter (Examples).

scribe.scr

;*=====================================================================*/
;*    serrano/prgm/project/scribe/www/scribe.scr                       */
;*    -------------------------------------------------------------    */
;*    Author      :  Manuel Serrano                                    */
;*    Creation    :  Thu Oct  4 01:28:40 2001                          */
;*    Last change :  Thu Jan  3 09:08:59 2002 (serrano)                */
;*    Copyright   :  2001-02 Manuel Serrano                            */
;*    -------------------------------------------------------------    */
;*    The Scribe web page                                              */
;*=====================================================================*/

;*---------------------------------------------------------------------*/
;*    Document style                                                   */
;*---------------------------------------------------------------------*/
(style 'web 'serrano)

;*---------------------------------------------------------------------*/
;*    Document                                                         */
;*---------------------------------------------------------------------*/
(document :title "Scheme Scribe homepage"
          :author (manuel-serrano 'author)
          
;*---------------------------------------------------------------------*/
;*    Margins                                                          */
;*---------------------------------------------------------------------*/
(set! *scribe-html-left-margin*
      (margin :bg *scribe-tbackground*
              :tbg "#800020"
              :tfg "#f7e0c0"
              :width 200
              (section :title "Table of contents" :toc #f :number #f
                       (ref :id "Scheme Scribe homepage")
                       (table-of-contents))
              (linebreak)
              (section :title "Documentation" :toc #f :number #f
                       (ref :url *scribe-white-url* "White paper")
                       (linebreak 2)
                       (ref :url *scribe-user-url* "User manual")
                       (linebreak)
                       (ref :url *scribe-expert-url* "Advanced manual")
                       (linebreak)
                       (ref :url *scribe-package-url* "Scribe styles"))
              (linebreak 4)
              (hrule)
              (it [If you have any comments on this web page or
if you have a contribution or an application that you would like pointed to
by this web page, please contact the maintainer of the page.])))

;*---------------------------------------------------------------------*/
;*    Local coloring                                                   */
;*---------------------------------------------------------------------*/
(define *prgm-color* "#dddddd")

(linebreak 1)
(p (center (frame (font :size "+1"
        (bold [Current version is ,(color :fg "red" *scribe-version*),
               released ,(begin *scribe-date*)])))))
(linebreak 1)

;*--- Presentation ----------------------------------------------------*/
(section :title "Presentation" :number #f :toc #f 

(p [Scheme Scribe (Scribe hereafter) is a text processor. 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. 
At first glance, Scribe looks like a mark-up language ,(emph "à la") HTML. 
So, there is ,(bold "no need") to be provided with computer programming 
skills in order to use Scribe.])

(p [A second look reveals that Scribe is actually a true programming
language, provided with high level features (such as objects,
higher order functions, regular and syntactic parsing, etc.). Scribe is based
on the ,(ref :url (make-file-name *bigloo-url* "doc/r5rs.html") "Scheme")
programming language.])

(p [From Scribe source files it is possible to produce various targets:
,(itemize (item [HTML pages that can be used to implement a web site.])
          (item [LaTeX files that can be used to produce high quality
                 Postscript or PDF files.])
          (item [Info files that suit the Emacs Info mode.])
          (item [Man pages for Unix documentation.])
          (item [Plain texts.])
          (item [MagicPoint slides.]))])
          
(p [Several Scribe demonstrations can be found on this web site. First, this
HTML page is a Scribe, have a look at the source code 
,(ref :chapter "Examples" "here"). Second and third, the Scribe 
,(ref :url *scribe-user-url* "user manual") and
,(ref :url *scribe-expert-url* "advanced manual") are also written in
Scribe.])

(p [The Scribe distribution also contains a compiler from Texi source files to
Scribe source files. An example of such a compilation can be found at
,(ref :url (make-file-name *bigloo-url* "doc/r5rs.html")). This example
shows how a Texi source file can be compiled to Scribe and then
compiled to HTML.])

(p [The regular Scribe compiler can produce Postscript files.
Here is an example of such a file: ,(ref :url "doc/scribe.ps").]))

;*--- News ------------------------------------------------------------*/
(section :title "News" :number #f [
,(itemize (item [,(bold "16 Sep 2002:") A CGI scripting library.])
          (item [,(bold "29 May 2002:") Important enhancements (bug fixes, 
                 languages extension). Support for Slides.])
          (item [,(bold "6 Feb 2002:") Important improvements in the 
                 JVM version.])
          (item [,(bold "1 Feb 2002:") TeX back-end improvements. Scribeinfo 
                 improvements.])
          (item [,(bold "2 Jan 2002:") enumerations require ,(tt "item")
                 constructions.])
          (item [,(bold "21 Dec 2001:") Release 0.6, bibliography redesign.])
          (item [,(bold "20 Dec 2001:") Release 0.5, JVM support.])
          (item [,(bold "19 Dec 2001:") Release 0.4])
          (item [,(bold "18 Dec 2001:") Release 0.3])
          (item [,(bold "14 Dec 2001:") Release 0.2]))])

;*--- Downloading -----------------------------------------------------*/
(section :title "Download" :number #f

(p [Two versions of Scribe exist. 
,(itemize (item [A ,(ref :subsection "Download native Scribe" "native") 
                 version: that is a version that compiles to native code 
                 for maximum efficiency.])
          (item [A ,(ref :subsection "Download JVM Scribe" "JVM") version:
                 that is a version that compiled to Java Virtual Machine 
                 for maximum portability.]))
All versions of the Scribe distribution can be found at:
,(ref :url (string-append "ftp://" *ftp-host* *ftp-dir* "/") 
(string-append "ftp://" *ftp-host* *ftp-dir* "/"))])

;; JVM version
(subsection :title "Download JVM Scribe" :number #f

(p [This pre-compiled version of Scribe does not require any
pre-installation. In particular, there is ,(color :fg "green" (bold "no need"))
to install the ,(ref :url *bigloo-url* "Bigloo compiler") in order to use it.])

(p 
 (map (lambda (title.file)
         (let* ((title (car title.file))
                (file (cadr title.file))
                (fsize (make-file-name *repository* file))
                (fftp (string-append "ftp://" *ftp-host* *ftp-dir* "/"
                                     file)))
           (if (file-exists? fsize)
               (p 
                `(,title ": "
                         ,(itemize (item (ref :url fftp
                                              (basename file)
                                              " ("
                                              (inexact->exact
                                               (/ (file-size fsize) 1024))
                                              "k)")))))
               (begin
                 (warning "download" "Can't file file -- " fsize)
                 #unspecified))))
       `((,[The ,(bold "zip") for Java virtual machine is]
          ,*scribe.zip*))))

(p [This pre-compiled version of Scribe should run everywhere it
exists a JDK 1.3 (or higher).]))

;; native version
(subsection :title "Download native Scribe" :number #f

(p [In order to install and compile native Scribe, you
,(color :fg "red" (bold "need")) to install the
,(ref :url *bigloo-url* "Bigloo compiler") version
,(ref :url *bigloo-url* "2.5a") or higher ,(color :fg "red" (bold " first")).
This is required for the source file tarball ,(bold "and") the RPM package.
In addition, the Bigloo version ,(color :fg "red" (bold "must")) support
,(color :fg "red" (bold "shared libraries")). It is impossible to compile 
and run Scribe on a platform that does not support this feature.])

(p 
 (map (lambda (title.file)
         (let* ((title (car title.file))
                (file (cadr title.file))
                (fsize (make-file-name *repository* file))
                (fftp (string-append "ftp://" *ftp-host* *ftp-dir* "/"
                                     file)))
           (if (file-exists? fsize)
               (p 
                `(,title ": "
                         ,(itemize (item (ref :url fftp
                                              (basename file)
                                              " ("
                                              (inexact->exact
                                               (/ (file-size fsize) 1024))
                                              "k)")))))
               (begin
                 (warning "download" "Can't file file -- " fsize)
                 #unspecified))))
       `((,[The source file distribution that can be used for ,(bold "Unix") systems and ,(bold "Win32/Cygwin") is]
          ,*scribe.tar.gz*)
         (,[The ,(bold "RPM") for i686 is]
          ,*scribe.rpm*))))

(p [Scribe portability matches the ,(ref :url *bigloo-url* "Bigloo")
portability. That is, it is known to compile and run under the following
systems:

,(apply itemize
        (map (lambda (p)
                (item (tt (car p)) " (" (cdr p) ")"))
             '(("x86-linux" . "Mandrake 8.0, Sun JDK 1.3")
               ("x86-FreeBSD" . "4.0")
               ("x86-win32" . "Windows 2000/Cygwin")
               ("PowerPC G4" . "MacOS X xnu-201.5")
               ("SPARC" . "Solaris 2.6 and 2.8, Sun JDK 1.3, Linux (Debian)")
               ("Compaq Alpha" . "Digital Unix 4.0f aka True64, JDK 1.3")
               ("Compaq Alpha" . "Linux 2.2 (Debian)")
               ("Arm" . "Linux (Debian)")
               ("IA64" . "Linux (Debian)")
               ("m68k" . "Linux (Debian)")
               ("Mips" . "Linux (Debian)")
               ("Mipsel" . "Linux (Debian)")
               ("s390" . "Linux (Debian)"))))

Even if not tested, it should run correctly on:
,(apply itemize 
        (map (lambda (p)
                (item (tt (car p)) " (" (cdr p) ")"))
             '(("SGI" . "IP32")
               ("Intel" . "NeXTStep")
               ("IBM RS-6000" . "AIX")
               ("SGI" . "IP20 and IP22")
               ("MAC PPC" . "2.2.15pre20"))))

It is known not to compile on:
,(itemize (item (tt (bold (color :fg "red" "Sparc (Linux)"))))
          (item (tt (bold (color :fg "red" "Mac (MacOS 9)")))))])))

;*--- Registration ----------------------------------------------------*/
(section :title "Mailing list" :number #f [

The Scribe mailing list is now hosted by
,(mailto :email "sympa@lists-sop.inria.fr?subject=HELP" "sophia.inria.fr.")
The new email address is ,(mailto :email "scribe@sophia.inria.fr").
,(linebreak 2)

Information requests, subcription/unsubscription to the mailing list must
be sent to ,(mailto :email "sympa@lists-sop.inria.fr.")

,(itemize (item [To ,(bold "subscribe") to the mailing list, simply send a
                 message with the  words ,(tt "subscribe scribe") in 
                 the ,(tt "Subject:") field to the above address. Alternatively
                 you can click the following link:
                 ,(mailto :email "sympa@lists-sop.inria.fr?subject=subscribe%20scribe" "subscribe now")])
          (item [To ,(bold "unsubscribe") to the mailing list, simply send
                 a message with the word ,(tt "unsubscribe scribe") in the 
                 ,(tt "Subject:") field to ,(tt "sympa@lists-sop.inria.fr.") 
                 Alternatively you can click the following link:
                 ,(mailto :email "sympa@lists-sop.inria.fr?subject=unsubscribe%20scribe" "unsubscribe now")])
          (item [To get some (bold "help") with the mailing list, simply send
                 a message with the word ,(tt "HELP") in the ,(tt "Subject:")
                 field to ,(tt "sympa@lists-sop.inria.fr."). Alternatively you 
                 can click the following link:
                 ,(mailto :email "sympa@lists-sop.inria.fr?subject=HELP" "help now")]))])

;*--- License ---------------------------------------------------------*/
(section :title "License" :number #f [
Scribe is distributed under the 
,(ref :url "ftp://ftp.gnu.ai.mit.edu/pub/gnu/COPYING" "Gnu Public License.")])

;*---------------------------------------------------------------------*/
;*    ChangeLog                                                        */
;*---------------------------------------------------------------------*/
(include "changelog.scr")

;*---------------------------------------------------------------------*/
;*    Sources                                                          */
;*---------------------------------------------------------------------*/
(chapter :subtitle "Examples" :number #f (p [
This web site is implemented by the means of two Scribe sources. So,
this web site can servers as an example of Scribe document. We start
presenting the main file ,(ref :section "scribe.scr" (code "scribe.scr"))
and then the second source, ,(ref :section "changelog.scr" 
(code "changelog.scr")), used to implement the ChangeLog
section. For the curious ones, check in the first source file the 
implementation of this ,(emph "meta-chapter") (,(ref :chapter "Examples")).])

(section :title "scribe.scr" :number #f
(prgm :language scribe (from-file "scribe.scr")))

(section :title "changelog.scr" :number #f
(prgm :language scribe (from-file "changelog.scr")))
))
changelog.scr

;*=====================================================================*/
;*    serrano/prgm/project/scribe/www/changelog.scr                    */
;*    -------------------------------------------------------------    */
;*    Author      :  Manuel Serrano                                    */
;*    Creation    :  Tue Dec 18 14:46:08 2001                          */
;*    Last change :  Tue Dec 18 15:32:54 2001 (serrano)                */
;*    Copyright   :  2001 Manuel Serrano                               */
;*    -------------------------------------------------------------    */
;*    ChangeLog                                                        */
;*=====================================================================*/

;*---------------------------------------------------------------------*/
;*    ChangeLog fontification                                          */
;*---------------------------------------------------------------------*/
(define (changelog obj)
  (parse-changelog (open-input-string obj)))

(define (parse-changelog port::input-port)
   (let ((g (regular-grammar ()
               ((bol (: "%%" (* all)))
                ;; a text inclusion
                (with-input-from-string (the-substring 2 (the-length))
                   (lambda ()
                      (let ((file (read)))
                         (append (changelog-from-file file)
                                 (ignore))))))
               ((bol (: (in ("AZ")) (+ all) #\:))
                ;; release date
                (let ((str (the-string)))
                  (let ((pos (pregexp-match-positions "\\([^)]+\\):" str)))
                    (match-case pos
                       (((?start . ?stop))
                        (cons* (substring str 0 start)
                               (bold (substring str start (-fx stop 1)))
                               ":"
                               (ignore)))
                       (else
                        (cons str (ignore)))))))
               ((bol (: (+ (in " \t")) (>= 4 #\*) (* all)))
                ;; distribution
                (let ((distrib (the-string)))
                   (cons (color :fg "#0000ff" (bold distrib)) (ignore))))
               ((bol (: (+ (in " \t")) #\* (out #\*)))
                ;; new features
                (let ((chg (the-string)))
                  (cons (color :fg "#00cc00"
                               (bold (string-append
                                      (substring chg 0 (-fx (the-length) 1))
                                      "** ")))
                        (ignore))))
               ((bol (: (+ (in " \t")) (= 3 #\*) (out #\*)))
                ;; bug fix
                (let ((distrib (the-string)))
                   (cons (color :fg "#ff0000" (bold distrib)) (ignore))))
               ((+ (out #\* #\Newline))
                ;; plain strings
                (let ((str (the-string)))
                   (cons str (ignore))))
               ((+ (or #\Newline #\*))
                ;; new lines
                (let ((nl (the-string)))
                  (cons nl (ignore))))
               (else
                ;; default
                (let ((c (the-failure)))
                   (if (eof-object? c)
                       '()
                       (error "prgm(changelog)" "Unexpected character" c)))))))
      (read/rp g port)))

;*---------------------------------------------------------------------*/
;*    changelog-from-file ...                                          */
;*---------------------------------------------------------------------*/
(define (changelog-from-file file)
  (if (file-exists? file)
      (let ((p (open-input-file file)))
        (if (input-port? p)
            (parse-changelog p)
            (error "prgm(changelog)" "Can't open file" file)))
      (error "prgm(changelog)" "Can't find file" file)))

;*---------------------------------------------------------------------*/
;*    Scribe ChangeLog                                                 */
;*---------------------------------------------------------------------*/
(chapter :subtitle "ChangeLog" :number #f

(prgm :language changelog [
,(from-file *scribe-changelog*)]))

This page has been generated by Scribe.
Last update Wed Dec 18 10:09:15 2002