Skip to content

Commit

Permalink
Fixes following PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
jonludlam committed Nov 12, 2024
1 parent bdd5ccc commit 07c9dbc
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# **[odoc](https://ocaml.github.io/odoc/) : OCaml Documentation Generator**
</p>

<p align="center">
<a href="https://ocaml.ci.dev/github/ocaml/odoc">
Expand Down
2 changes: 1 addition & 1 deletion src/driver/dune_style.ml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ let of_dune_build dir =
[]
(* When dune has a notion of doc assets, do something *);
pkg_dir;
other_docs = Fpath.Set.empty;
other_docs = [];
config = Global_config.empty;
} )
| _ -> None)
Expand Down
2 changes: 1 addition & 1 deletion src/driver/odoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let compile_md ~output_dir ~input_file:file ~parent_id =
let _, f = Fpath.split_base file in
Some Fpath.(output_dir // Id.to_fpath parent_id // set_ext "odoc" f)
in
let cmd = !odoc_md % Fpath.to_string file % "--output-dir" % p output_dir in
let cmd = !odoc_md % p file % "--output-dir" % p output_dir in
let cmd = cmd % "--parent-id" % Id.to_string parent_id in
let desc = Printf.sprintf "Compiling Markdown %s" (Fpath.to_string file) in
let lines = Cmd_outputs.submit desc cmd output_file in
Expand Down
4 changes: 1 addition & 3 deletions src/driver/odoc_unit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,7 @@ let of_packages ~output_dir ~linked_dir ~index_dir ~extra_libs_paths
let lib_units :> t list list = List.map (of_lib pkg) pkg.libraries in
let mld_units :> t list list = List.map (of_mld pkg) pkg.mlds in
let asset_units :> t list list = List.map (of_asset pkg) pkg.assets in
let md_units :> t list list =
Fpath.Set.fold (fun md acc -> of_md pkg md :: acc) pkg.other_docs []
in
let md_units :> t list list = List.map (of_md pkg) pkg.other_docs in
List.concat (lib_units @ mld_units @ asset_units @ md_units)
in
List.concat_map of_package pkgs
6 changes: 3 additions & 3 deletions src/driver/packages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type t = {
libraries : libty list;
mlds : mld list;
assets : asset list;
other_docs : Fpath.Set.t;
other_docs : Fpath.t list;
pkg_dir : Fpath.t;
config : Global_config.t;
}
Expand All @@ -103,8 +103,7 @@ let pp fmt t =
}@]"
t.name t.version (Fmt.Dump.list pp_libty) t.libraries (Fmt.Dump.list pp_mld)
t.mlds (Fmt.Dump.list pp_asset) t.assets (Fmt.Dump.list Fpath.pp)
(Fpath.Set.elements t.other_docs)
Fpath.pp t.pkg_dir
t.other_docs Fpath.pp t.pkg_dir

let maybe_prepend_top top_dir dir =
match top_dir with None -> dir | Some d -> Fpath.(d // dir)
Expand Down Expand Up @@ -476,6 +475,7 @@ let of_libs ~packages_dir libs =
m "%d mlds for package %s (from %d odoc_pages)"
(List.length mlds) pkg.name
(Fpath.Set.cardinal odoc_pages));
let other_docs = Fpath.Set.elements other_docs in
Some
{
name = pkg.name;
Expand Down
2 changes: 1 addition & 1 deletion src/driver/packages.mli
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type t = {
libraries : libty list;
mlds : mld list;
assets : asset list;
other_docs : Fpath.Set.t;
other_docs : Fpath.t list;
pkg_dir : Fpath.t;
config : Global_config.t;
}
Expand Down
2 changes: 1 addition & 1 deletion src/driver/voodoo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ let process_package pkg =
libraries;
mlds;
assets;
other_docs = Fpath.Set.empty;
other_docs = [];
pkg_dir = top_dir pkg;
config;
}
Expand Down
14 changes: 7 additions & 7 deletions src/markdown/odoc_md.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ let parse id input_s =
Lexing.{ pos_fname = input_s; pos_lnum = 1; pos_cnum = 0; pos_bol = 0 }
in
let str = In_channel.(with_open_bin input_s input_all) in
let content, _warnings = Doc_of_md.parse_comment ~location ~text:str () in
let content, () =
let content, parser_warnings = Doc_of_md.parse_comment ~location ~text:str () in
let ((content, ()), semantics_warnings) =
Semantics.ast_to_comment ~internal_tags:Expect_none ~sections_allowed:`All
~tags_allowed:true
~tags_allowed:false
~parent_of_sections:(id :> Paths.Identifier.LabelParent.t)
content []
|> Error.raise_warnings
|> Error.unpack_warnings
in
content
(content, List.map Error.t_of_parser_t parser_warnings @ semantics_warnings)

let mk_page input_s id content =
(* Construct the output file representation *)
Expand Down Expand Up @@ -48,13 +48,13 @@ let run input_s parent_id_str odoc_dir =
(parent_id, Odoc_model.Names.PageName.make_std page_name)
in

let content = parse id input_s in
let content, warnings = parse id input_s in
let page = mk_page input_s id content in

let output =
Fpath.(v odoc_dir // v parent_id_str / ("page-" ^ page_name ^ ".odoc"))
in
Odoc_odoc.Odoc_file.save_page output ~warnings:[] page
Odoc_odoc.Odoc_file.save_page output ~warnings page

open Cmdliner

Expand Down

0 comments on commit 07c9dbc

Please sign in to comment.