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.
-customdirDisplay the custom generators default directory.
-i directoryAdd the given directory to the path where to look for custom generators.
-d dirGenerate files in directory dir, rather than in the current directory.
-dump fileDump collected information into file. This information can be read with the -load option in a subsequent invocation of ocamldoc.
-hide modulesHide 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-mliInverse 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-codeAlways 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 fileLoad information from file, which has been produced by ocamldoc dump. Several -load options can be given.
-m flagsSpecify merge options between interfaces and implementations. (see section 15.1.2 for details). flags can be one or several of the following characters:
dmerge description
amerge @author
vmerge @version
lmerge @see
smerge @since
omerge @deprecated
pmerge @param
emerge @raise
rmerge @return
Amerge everything
-no-custom-tagsDo not allow custom @-tags (see section 15.2.5).
-no-stopKeep elements placed after/between the (**/**) special comment(s) (see section 15.2).
-o fileOutput the generated documentation to file instead of ocamldoc.out. This option is meaningful only in conjunction with the -latex, -texi, or -dot options.
-pp commandPipe sources through preprocessor command.
-sortSort the list of top-level modules before generating the documentation.
-starsRemove blank characters until the first asterisk ('*') in each line of comments.
-t titleUse title as the title for the generated documentation.
-intro fileUse 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.
-vVerbose mode. Display progress information.
-versionPrint the version string and exit.
-warn-errorTreat Ocamldoc warnings as errors.
-hide-warningsDo not print OCamldoc warnings.
-help or --helpDisplay 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 directoryAdd directory to the list of directories search for compiled interface files (.cmi files).
-nolabels-rectypesAllow arbitrary recursive types. (See the -rectypes option to ocamlc.)
The following options apply in conjunction with the -html option:
-all-paramsDisplay the complete list of parameters for functions and methods.
-css-style filenameUse filename as the Cascading Style Sheet file.
-colorize-codeColorize 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-onlyGenerate 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 prefixGive 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,styleAssociate 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.
-noheaderSuppress header in generated documentation.
-notocDo not generate a table of contents.
-notrailerSuppress trailer in generated documentation.
-sepfilesGenerate 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.