diff --git a/src/odoc/bin/main.ml b/src/odoc/bin/main.ml index 6a3f3d5e21..103b627460 100644 --- a/src/odoc/bin/main.ml +++ b/src/odoc/bin/main.ml @@ -340,10 +340,10 @@ module Odoc_latex : sig val info: Term.info end = struct - let latex directories output_dir syntax input_file = + let latex directories output_dir syntax with_children input_file = let env = Env.create ~important_digests:false ~directories in let file = Fs.File.of_string input_file in - Latex.from_odoc ~env ~syntax ~output:output_dir file + Latex.from_odoc ~env ~syntax ~output:output_dir ~with_children file let cmd = let input = @@ -356,9 +356,14 @@ end = struct in Arg.(value & opt (pconv convert_syntax) (Odoc_document.Renderer.OCaml) @@ info ~docv:"SYNTAX" ~doc ~env ["syntax"]) in + let with_children = + let doc = "Include children at the end of the page" in + Arg.(value & opt bool true & info ~docv:"BOOL" ~doc ["with-children"]) + in Term.(const handle_error $ (const latex $ odoc_file_directories $ dst ~create:true () $ syntax $ + with_children $ input)) let info = diff --git a/src/odoc/latex.ml b/src/odoc/latex.ml index 5f964818ca..f6ac00d5d8 100644 --- a/src/odoc/latex.ml +++ b/src/odoc/latex.ml @@ -64,7 +64,7 @@ let traverse ~f t = aux [] t -let from_odoc ~env ?(syntax=Renderer.OCaml) ~output:root_dir input = +let from_odoc ~env ?(syntax=Renderer.OCaml) ?(with_children=true) ~output:root_dir input = Root.read input >>= fun root -> match root.file with | Page page_name -> @@ -88,7 +88,7 @@ let from_odoc ~env ?(syntax=Renderer.OCaml) ~output:root_dir input = let page_name = String.concat ~sep:"." (List.rev @@ name :: parents) in with_tex_file ~pkg_dir ~page_name (fun ppf -> content ppf; - link_children pkg_dir parents name children_names ppf + if with_children then link_children pkg_dir parents name children_names ppf ) ); Ok ()