From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA03818 for caml-redistribution@pauillac.inria.fr; Sun, 7 Nov 1999 22:41:18 +0100 (MET) Resent-Message-Id: <199911072141.WAA03818@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA13258 for ; Sat, 6 Nov 1999 12:39:39 +0100 (MET) Received: from cumulus.is.gaertner.de (cumulus.is.gaertner.de [194.45.135.209]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id MAA12219 for ; Sat, 6 Nov 1999 12:39:36 +0100 (MET) Received: by cumulus.is.gaertner.de (Postfix, from userid 1000) id 1C9DC977A; Sat, 6 Nov 1999 12:16:37 +0100 (CET) Date: Sat, 6 Nov 1999 12:16:37 +0100 From: Christian Lindig To: Vincent Poirriez Cc: Caml Mailing List Subject: Re: LaTeX listings and (o)caml Message-ID: <19991106121636.A246@cumulus> Reply-To: Christian Lindig Mail-Followup-To: Vincent Poirriez , Caml Mailing List References: <38230003.A29975D9@univ-valenciennes.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <38230003.A29975D9@univ-valenciennes.fr>; from Vincent.Poirriez@univ-valenciennes.fr on Fri, Nov 05, 1999 at 04:04:19PM +0000 Resent-From: weis@pauillac.inria.fr Resent-Date: Sun, 7 Nov 1999 22:41:18 +0100 Resent-To: caml-redistribution@pauillac.inria.fr On Fri, Nov 05, 1999 at 04:04:19PM +0000, Vincent Poirriez wrote: > before I start the work, does someone have designed a "definition" > of the caml languages to be used with the package listings of LaTeX? > This should provide an easy way to have nice formatted code in > slides I don't know about the package listing of LaTeX but have written a tool that marks up OCaml code for HTML, XML, Vile, and Lout. It has a modular design, so adding a new LaTeX backend takes less than 100 lines of code. The tool recognizes comments, strings, keywords, operators, etc by scanning an OCaml source and permits the backend to format them. All other parts of a source file pass untouched. The man page is attached below -- mail me for the code if you are interested. I think a similar tool was announced on this list some time ago. -- Christian -- Christian Lindig Gaertner Datensysteme GbR, Braunschweig, Germany http://www.gaertner.de/~lindig lindig@gaertner.de phone: +49 531 233 55 55 fax: +49 531 233 55 56 NAME ocamldoc - markup Objective Caml source ocde SYNOPSIS ocamldoc [ *format* ] [ *file* ] ocamldoc -help ocamldoc -version DESCRIPTION ocamldoc reads an Objective Caml (see ocaml(1)) source file and pretty prints it accordingly to *format*. Pretty printing is done by highlighting keywords, comments, operators, and literals in the source; all other parts of the source pass untouched. The OCaml source is read from *file* or *stdin*; output goes to *stdout*. Please note, that ocamldoc does not reformat the source code like indent(1) does for C code. It only marks up some syntactic classes inside the code. OPTIONS -html [ -title *title* ] The OCaml source is prepared for HTML. When a *title* is specified a standalone HTML file is generated. Without the - title flag code is embedded into a
 element but the
        mandatory outer structure of a HTML document is missing.
        The -title flag can be abbreviated as -t. Highlighting is
        not hard coded into the output but achieved through
        Cascading Style Sheets (CSS): each syntactical element is
        embedded into a  element with an additional class
        attribute denoting its syntactical class. For example:

            let hello = "hello"

        becomes (without the line breakes):

            let hello = 
            "hello"

        The class attributes are matched by CSS rules which define
        the actual appearance of the code. A sample CSS file comes
        with the distribution. A standalone HTML page points to a
        CSS file ocaml.css in the actual directory.

    -xml [ -title *title* ]
        The formatting for XML works very much like the formatting
        for HTML. With a given *title* a standalone XML document is
        generated; the outermost element is  with a title
        attribute. The code inside this element is exactly like when
        formatting for HTML.

    -vile
        Highlighting for the Vile editor vi(1). Syntax highlighting
        in Vile is done by external filters like this. See the Vile
        documentation for the format. This version of ocamldoc works
        with Vile 8.3.

        When the ocamldoc binary is called under the name vile-
        ocaml-filt and without a format option it formats the input
        also for Vile. This feature makes ocamldoc compliant to the
        Vile filter naming scheme.

    -lout
        Source code is marked up for the Basser Lout document
        formatter and a Lout package camlprint provided by Basile
        Starynkevitch.

    -ascii
        The input is not marked up at all. This serves mainly as a
        test case for the internal scanner of ocamldoc.

    -version
        Reports the current version of ocamldoc to stdout.

    -help
        Prints a summary of command line options to stderr.

RETURN VALUE
    ocamldoc returns 1 in case of an error and 0 on success.

SEE ALSO
    ocaml(1)

AUTHOR
    Christian Lindig, lindig@gaertner.de,
    http://www.gaertner.de/~lindig