Skip to content

Commit

Permalink
Driver: reenable non-selected landing pages in remap mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jonludlam committed Dec 16, 2024
1 parent 785294a commit 2fb5e3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/driver/landing_pages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ let src ~dirs ~pkg ~index =
let rel_dir = src_dir pkg in
make_index ~dirs ~rel_dir ~index ~content ()

let package_list ~dirs all =
let package_list ~dirs ~remap all =
let content all ppf =
let sorted_packages =
all |> List.sort (fun n1 n2 -> String.compare n1.name n2.name)
in
fpf ppf "{0 List of all packages}@\n";
let print_pkg pkg =
if pkg.selected then fpf ppf "- {{:%s/index.html}%s}@\n" pkg.name pkg.name
if pkg.selected || not remap then fpf ppf "- {{:%s/index.html}%s}@\n" pkg.name pkg.name
in
List.iter print_pkg sorted_packages
in
Expand Down
2 changes: 1 addition & 1 deletion src/driver/landing_pages.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ val package : dirs:dirs -> pkg:Packages.t -> index:index -> mld unit

val src : dirs:dirs -> pkg:Packages.t -> index:index -> mld unit

val package_list : dirs:dirs -> Packages.t list -> mld unit
val package_list : dirs:dirs -> remap:bool -> Packages.t list -> mld unit
11 changes: 6 additions & 5 deletions src/driver/odoc_units_of.ml
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,11 @@ let packages ~dirs ~extra_paths ~remap (pkgs : Packages.t list) : t list =
in
let index = index_of pkg in
let units = List.concat_map (of_module pkg lib lib_deps) lib.modules in
if pkg.selected then
if remap && not pkg.selected then
units
else
let landing_page :> t = Landing_pages.library ~dirs ~pkg ~index lib in
landing_page :: units
else units
in
let of_mld pkg (mld : Packages.mld) : mld unit list =
let open Fpath in
Expand Down Expand Up @@ -268,12 +269,13 @@ let packages ~dirs ~extra_paths ~remap (pkgs : Packages.t list) : t list =
(Fpath.normalize (Fpath.v "./index.mld")))
pkg.mlds
in
if has_index_page || not pkg.selected then []
if has_index_page || (remap && not pkg.selected) then []
else
let index = index_of pkg in
[ Landing_pages.package ~dirs ~pkg ~index ]
in
let src_index :> t list =
if remap && not pkg.selected then [] else
if
(* Some library has a module which has an implementation which has a source *)
List.exists
Expand All @@ -285,7 +287,6 @@ let packages ~dirs ~extra_paths ~remap (pkgs : Packages.t list) : t list =
| _ -> false)
lib.Packages.modules)
pkg.libraries
&& pkg.selected
then
let index = index_of pkg in
[ Landing_pages.src ~dirs ~pkg ~index ]
Expand All @@ -296,5 +297,5 @@ let packages ~dirs ~extra_paths ~remap (pkgs : Packages.t list) : t list =
@ mld_units @ asset_units @ md_units)
in

let pkg_list :> t = Landing_pages.package_list ~dirs pkgs in
let pkg_list :> t = Landing_pages.package_list ~dirs ~remap pkgs in
pkg_list :: List.concat_map of_package pkgs

0 comments on commit 2fb5e3f

Please sign in to comment.