Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/odoc/bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,19 @@ end = struct
let generate = Generate.(cmd, info)

module Targets = struct
let list_targets output_dir _ extra odoc_file =
let list_targets output_dir directories extra odoc_file =
let odoc_file = Fs.File.of_string odoc_file in
Rendering.targets_odoc ~renderer:R.renderer ~output:output_dir ~extra
odoc_file
let env =
Env.create ~important_digests:false ~directories ~open_modules:[]
in
Rendering.targets_odoc ~env ~warn_error:false ~syntax:OCaml
~renderer:R.renderer ~output:output_dir ~extra odoc_file

let back_compat =
let doc = "For backwards compatibility. Ignored." in
let doc =
"For backwards compatibility when processing odoc rather than odocl \
files."
in
Arg.(
value
& opt_all (convert_directory ()) []
Expand Down
10 changes: 8 additions & 2 deletions src/odoc/rendering.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ let render_odoc ~env ~warn_error ~syntax ~renderer ~output extra file =
let generate_odoc ~syntax ~renderer ~output extra file =
document_of_odocl ~syntax file >>= render_document renderer ~output ~extra

let targets_odoc ~renderer ~output:root_dir ~extra odoctree =
document_of_odocl ~syntax:OCaml odoctree >>= fun odoctree ->
let targets_odoc ~env ~warn_error ~syntax ~renderer ~output:root_dir ~extra
odoctree =
let doc =
if Fpath.get_ext odoctree = ".odoc" then
document_of_input ~env ~warn_error ~syntax odoctree
else document_of_odocl ~syntax:OCaml odoctree
in
doc >>= fun odoctree ->
let pages = renderer.Renderer.render extra odoctree in
Renderer.traverse pages ~f:(fun filename _content ->
let filename = Fpath.normalize @@ Fs.File.append root_dir filename in
Expand Down
3 changes: 3 additions & 0 deletions src/odoc/rendering.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ val generate_odoc :
(unit, [> msg ]) result

val targets_odoc :
env:Env.builder ->
warn_error:bool ->
syntax:Renderer.syntax ->
renderer:'a Renderer.t ->
output:Fs.directory ->
extra:'a ->
Expand Down