From c66a4340aef966ca48dff04c8dbcff9da32eba8b Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 16 Dec 2024 10:04:36 +0000 Subject: [PATCH] Driver: reenable non-selected landing pages in remap mode --- src/driver/landing_pages.ml | 5 +++-- src/driver/landing_pages.mli | 2 +- src/driver/odoc_units_of.ml | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/driver/landing_pages.ml b/src/driver/landing_pages.ml index 7258e77366..1ac8cd5d47 100644 --- a/src/driver/landing_pages.ml +++ b/src/driver/landing_pages.ml @@ -96,14 +96,15 @@ 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 diff --git a/src/driver/landing_pages.mli b/src/driver/landing_pages.mli index 378ab6e731..cf4ae96a2f 100644 --- a/src/driver/landing_pages.mli +++ b/src/driver/landing_pages.mli @@ -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 diff --git a/src/driver/odoc_units_of.ml b/src/driver/odoc_units_of.ml index 28a3317fac..2f55ec6c60 100644 --- a/src/driver/odoc_units_of.ml +++ b/src/driver/odoc_units_of.ml @@ -200,10 +200,10 @@ 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 @@ -268,13 +268,14 @@ 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 + if remap && not pkg.selected then [] + else if (* Some library has a module which has an implementation which has a source *) List.exists (fun lib -> @@ -285,7 +286,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 ] @@ -296,5 +296,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