Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver: reenable non-selected landing pages in remap mode #1266

Merged
merged 1 commit into from
Dec 16, 2024
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
5 changes: 3 additions & 2 deletions src/driver/landing_pages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
12 changes: 6 additions & 6 deletions src/driver/odoc_units_of.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand All @@ -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 ]
Expand All @@ -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
Loading