From: Christian Lindig <lindig@cumulus.is.gaertner.de>
To: Vincent Poirriez <Vincent.Poirriez@univ-valenciennes.fr>
Cc: Caml Mailing List <caml-list@inria.fr>
Subject: Re: LaTeX listings and (o)caml
Date: Sat, 6 Nov 1999 12:16:37 +0100 [thread overview]
Message-ID: <19991106121636.A246@cumulus> (raw)
In-Reply-To: <38230003.A29975D9@univ-valenciennes.fr>; from Vincent.Poirriez@univ-valenciennes.fr on Fri, Nov 05, 1999 at 04:04:19PM +0000
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 <pre> 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 <span> element with an additional class
attribute denoting its syntactical class. For example:
let hello = "hello"
becomes (without the line breakes):
<span class='keyword'>let</span> hello <span
class='operator'>=</span>
<span class='strlit'>"hello"</span>
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 <src> 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
prev parent reply other threads:[~1999-11-07 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-05 16:04 Vincent Poirriez
1999-11-06 11:16 ` Christian Lindig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19991106121636.A246@cumulus \
--to=lindig@cumulus.is.gaertner.de \
--cc=Vincent.Poirriez@univ-valenciennes.fr \
--cc=caml-list@inria.fr \
--cc=lindig@gaertner.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox