Skip to content

Commit 2b33511

Browse files
committed
Add an option to not link children
1 parent edab964 commit 2b33511

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/odoc/bin/main.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,10 @@ module Odoc_latex : sig
340340
val info: Term.info
341341
end = struct
342342

343-
let latex directories output_dir syntax input_file =
343+
let latex directories output_dir syntax with_children input_file =
344344
let env = Env.create ~important_digests:false ~directories in
345345
let file = Fs.File.of_string input_file in
346-
Latex.from_odoc ~env ~syntax ~output:output_dir file
346+
Latex.from_odoc ~env ~syntax ~output:output_dir ~with_children file
347347

348348
let cmd =
349349
let input =
@@ -356,9 +356,14 @@ end = struct
356356
in
357357
Arg.(value & opt (pconv convert_syntax) (Odoc_document.Renderer.OCaml) @@ info ~docv:"SYNTAX" ~doc ~env ["syntax"])
358358
in
359+
let with_children =
360+
let doc = "Include children at the end of the page" in
361+
Arg.(value & opt bool true & info ~docv:"BOOL" ~doc ["with-children"])
362+
in
359363
Term.(const handle_error $ (const latex $
360364
odoc_file_directories $ dst ~create:true () $
361365
syntax $
366+
with_children $
362367
input))
363368

364369
let info =

src/odoc/latex.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ let traverse ~f t =
6464
aux [] t
6565

6666

67-
let from_odoc ~env ?(syntax=Renderer.OCaml) ~output:root_dir input =
67+
let from_odoc ~env ?(syntax=Renderer.OCaml) ?(with_children=true) ~output:root_dir input =
6868
Root.read input >>= fun root ->
6969
match root.file with
7070
| Page page_name ->
@@ -88,7 +88,7 @@ let from_odoc ~env ?(syntax=Renderer.OCaml) ~output:root_dir input =
8888
let page_name = String.concat ~sep:"." (List.rev @@ name :: parents) in
8989
with_tex_file ~pkg_dir ~page_name (fun ppf ->
9090
content ppf;
91-
link_children pkg_dir parents name children_names ppf
91+
if with_children then link_children pkg_dir parents name children_names ppf
9292
)
9393
);
9494
Ok ()

0 commit comments

Comments
 (0)