From f5acc737b0c5829ea1688ba5798884ee68be5a27 Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Thu, 5 Dec 2024 14:28:43 +0100 Subject: [PATCH] Driver: don't include source dir if no implementation are rendered --- src/driver/odoc_units_of.ml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/driver/odoc_units_of.ml b/src/driver/odoc_units_of.ml index 685254a39f..2e0d03a41f 100644 --- a/src/driver/odoc_units_of.ml +++ b/src/driver/odoc_units_of.ml @@ -270,7 +270,18 @@ let packages ~dirs ~extra_paths ~remap (pkgs : Packages.t list) : t list = [ Landing_pages.package ~dirs ~pkg ~index ] in let src_index :> t list = - if List.length pkg.libraries > 0 then + if + (* Some library has a module which has an implementation which has a source *) + List.exists + (fun lib -> + List.exists + (fun m -> + match m.Packages.m_impl with + | Some { mip_src_info = Some _; _ } -> true + | _ -> false) + lib.Packages.modules) + pkg.libraries + then let index = index_of pkg in [ Landing_pages.src ~dirs ~pkg ~index ] else []