The command line analysis is performed after loading the module containing the documentation generator, thus allowing command line options to be added to the list of existing ones. Adding an option can be done with the function
Odoc_args.add_option : string * Arg.spec * string -> unit
Note: Existing command line options can be redefined using this function.
Let custom.ml be the file defining a new generator class. Compilation of custom.ml can be performed by the following command :
ocamlc -I +ocamldoc -c custom.ml
The file custom.cmo is created and can be used this way :
ocamldoc -g custom.cmo other-options source-files
It is important not to give the -html or any other option selecting a built in generator to ocamldoc, which would result in using this generator instead of the one you just loaded.
It is possible to define a generator class in several modules, which are defined in several files file1.ml[i], file2.ml[i], ..., fileN.ml[i]. A .cma library file must be created, including all these files.
The following commands create the custom.cma file from files file1.ml[i], ..., fileN.ml[i] :
ocamlc -I +ocamldoc -c file1.ml[i] ocamlc -I +ocamldoc -c file2.ml[i] ... ocamlc -I +ocamldoc -c fileN.ml[i] ocamlc -o custom.cma -a file1.cmo file2.cmo ... fileN.cmo
Then, the following command uses custom.cma as custom generator:
ocamldoc -g custom.cma other-options source-files
Again, it is important not to give the -html or any other option selecting a built in generator to ocamldoc, which would result in using this generator instead of the one you just loaded.