OCamldoc は ocamldoc コマンドで以下のように起動します.
ocamldoc options sourcefiles
以下のオプションによって生成されるドキュメントのフォーマットが決定されます.
-html
HTMLでドキュメントを生成します.生成されるHTMLのページはカレントディレクトリか, -d
オプションので指定されたディレクトリに置かれます.
生成された style.css
ファイルを編集するか, --css-style
オプションを使用して指定したユーザ独自のスタイルシートによって,生成されたページのスタイルをカスタマイズすることができます.
style.css
ファイルは既に存在するときには生成されません.
-latex
LaTeX としてドキュメントを生成します.生成される LaTeX ドキュメントは ocamldoc.out
か,もしくは -o
オプションで指定されたファイル名として保存されます.
このドキュメントはスタイルファイル ocamldoc.sty
を使用します.このファイルは -latex
オプションを使用した時に生成され,もし既に存在していれば生成されません.このファイルを編集してLaTeXドキュメントのスタイルをカスタマイズすることもできます.
-texi
TeXinfo のフォーマットでドキュメントを生成します.生成された LaTeX ドキュメントは ocamldoc.out
か -o
オプションで指定されたファイル名で保存されます.
-man
Unix man page としてドキュメントを生成します.生成されたページはカレントディレクトリか -d
オプションで指定されたディレクトリに保存されます.
-dot
表示および処理のしやすい dot による形式でトップレベルモジュールに対する依存グラフを生成します.dot ツールは http://www.research.att.com/sw/tools/graphviz/
から取得できます.グラフのテキストによる表現は ocamldoc.out
に出力されるか, -o
オプションで指定されたファイルに出力されます.ocamldoc.out
を dot ツールに入力してグラフを表示することができます.
-g
file.cm[o,a]
Dynamically load the given file, which defines a custom documentation generator. See section 15.4.1. This option is supported by the ocamldoc command, but not by its native-code version ocamldoc.opt. If the given file is a simple one and does not exist in the current directory, then ocamldoc looks for it in the custom generators default directory, and in the directories specified with optional -i options.
-customdir
Display the custom generators default directory.
-i
directory
Add the given directory to the path where to look for custom generators.
-d
dir
Generate files in directory dir, rather than in the current directory.
-dump
file
Dump collected information into file. This information can be read with the -load option in a subsequent invocation of ocamldoc.
-hide
modules
Hide the given complete module names in the generated documentation modules is a list of complete module names are separated by ',', without blanks. For instance: Pervasives,M2.M3.
-inv-merge-ml-mli
Inverse implementations and interfaces when merging. All elements in implementation files are kept, and the -m option indicates which parts of the comments in interface files are merged with the comments in implementation files.
-keep-code
Always keep the source code for values, methods and instance variables, when available. The source code is always kept when a .ml file is given, but is by default discarded when a .mli is given. This option allows to always keep the source code.
-load
file
Load information from file, which has been produced by ocamldoc dump. Several -load options can be given.
-m
flags
Specify merge options between interfaces and implementations. (see section 15.1.2 for details). flags can be one or several of the following characters:
d
merge description
a
merge @author
v
merge @version
l
merge @see
s
merge @since
o
merge @deprecated
p
merge @param
e
merge @raise
r
merge @return
A
merge everything
-no-custom-tags
Do not allow custom @-tags (see section 15.2.5).
-no-stop
Keep elements placed after/between the (**/**) special comment(s) (see section 15.2).
-o
file
Output the generated documentation to file instead of ocamldoc.out. This option is meaningful only in conjunction with the -latex, -texi, or -dot options.
-pp
command
Pipe sources through preprocessor command.
-sort
Sort the list of top-level modules before generating the documentation.
-stars
Remove blank characters until the first asterisk ('*') in each line of comments.
-t
title
Use title as the title for the generated documentation.
-intro
file
Use content of file as ocamldoc text to use as introduction (HTML, LATEXand TeXinfo only). For HTML, the file is used to create the whole index.html file.
-v
Verbose mode. Display progress information.
-version
Print the version string and exit.
-warn-error
Treat Ocamldoc warnings as errors.
-hide-warnings
Do not print OCamldoc warnings.
-help
or --help
Display a short usage summary and exit.
OCamldoc calls the Objective Caml type-checker to obtain type informations. The following options impact the type-checking phase. They have the same meaning as for the ocamlc and ocamlopt commands.
-I
directory
Add directory to the list of directories search for compiled interface files (.cmi files).
-nolabels
-rectypes
Allow arbitrary recursive types. (See the -rectypes option to ocamlc.)
The following options apply in conjunction with the -html option:
-all-params
Display the complete list of parameters for functions and methods.
-css-style
filename
Use filename as the Cascading Style Sheet file.
-colorize-code
Colorize the OCaml code enclosed in [ ] and \{[ ]\}, using colors to emphasize keywords, etc. If the code fragments are not syntactically correct, no color is added.
-index-only
Generate only index files.
Use a short form to display functors:
module M : functor (A:Module) -> functor (B:Module2) -> sig .. end is displayed as module M (A:Module) (B:Module2) : sig .. end
.
The following options apply in conjunction with the -latex option:
-latex-value-prefix
prefix
Give a prefix to use for the labels of the values in the generated LaTeX document. The default prefix is the empty string. You can also use the options -latex-type-prefix, -latex-exception-prefix, latex-module-prefix, -latex-module-type-prefix, -latex-class-prefix, latex-class-type-prefix, -latex-attribute-prefix and -latex-method-prefix.
These options are useful when you have, for example, a type and a value with the same name. If you do not specify prefixes, LaTeX will complain about multiply defined labels.
latextitle
n,style
Associate style number n to the given LaTeX sectioning command style, e.g. section or subsection. (LaTeX only.) This is useful when including the generated document in another LaTeX document, at a given sectioning level. The default association is 1 for section, 2 for subsection, 3 for subsubsection, 4 for paragraph and 5 for subparagraph.
-noheader
Suppress header in generated documentation.
-notoc
Do not generate a table of contents.
-notrailer
Suppress trailer in generated documentation.
-sepfiles
Generate one .tex file per toplevel module, instead of the global ocamldoc.out file.
The following options apply in conjunction with the -texi option:
The following options apply in conjunction with the -dot option:
The following options apply in conjunction with the -man option:
Information on a module can be extracted either from the .mli or .ml file, or both, depending on the files given on the command line. When both .mli and .ml files are given for the same module, information extracted from these files is merged according to the following rules:
The following rules must be respected in order to avoid name clashes resulting in cross-reference errors:
Avoid the following construction:
open Foo (* which has a module Bar with a value x *) module Foo = struct module Bar = struct let x = 1 end end let dummy = Bar.x
In this case, OCamldoc will associate Bar.x to the x of module Foo defined just above, instead of to the Bar.x defined in the opened module Foo.