Cosmetic changes for default package entry point.

This commit is contained in:
Thomas Refis 2018-03-23 17:14:55 +00:00 committed by Rudi Grinberg
parent 244773ef80
commit 77c717b9af
3 changed files with 24 additions and 17 deletions

View File

@ -1018,7 +1018,9 @@ module Gen(P : Install_rules.Params) = struct
Odoc.init ~modules_by_lib:(fun ~dir lib ->
let m = modules_by_lib ~dir lib in
match m.alias_module with
| Some m -> [m]
| Some alias_mod ->
[Option.value ~default:alias_mod
(Module.Name.Map.find m.modules m.main_module_name)]
| None -> Module.Name.Map.values m.modules
) ~mlds_of_dir
end

View File

@ -408,18 +408,23 @@ module Gen (S : sig val sctx : SC.t end) = struct
|> List.sort ~compare:(fun (x, _) (y, _) ->
String.compare (Lib.name x) (Lib.name y))
|> List.iter ~f:(fun (lib, modules) ->
Printf.bprintf b "{1 Library %s}\n" (Lib.name lib);
Buffer.add_string b (
sprintf
"{1 Library %s}\n\
This library exposes the following toplevel modules:\n\
{!modules:%s}\n"
(Lib.name lib)
(modules
|> List.sort ~compare:(fun x y ->
Module.Name.compare (Module.name x) (Module.name y))
|> List.map ~f:(fun m -> Module.Name.to_string (Module.name m))
|> String.concat ~sep:" ")
)
match modules with
| [ x ] ->
sprintf
"The entry point of this library is the module:\n{!module-%s}.\n"
(Module.Name.to_string (Module.name x))
| _ ->
sprintf
"This library exposes the following toplevel modules:\n\
{!modules:%s}.\n"
(modules
|> List.sort ~compare:(fun x y ->
Module.Name.compare (Module.name x) (Module.name y))
|> List.map ~f:(fun m -> Module.Name.to_string (Module.name m))
|> String.concat ~sep:" ")
);
);
Buffer.contents b

View File

@ -43,12 +43,12 @@
$ $JBUILDER build @foo-mld -j1 --display short --root .
{1 Library foo}
This library exposes the following toplevel modules:
{!modules:Foo Foo2}
{!modules:Foo Foo2}.
{1 Library foo.byte}
This library exposes the following toplevel modules:
{!modules:Foo_byte}
The entry point of this library is the module:
{!module-Foo_byte}.
$ $JBUILDER build @bar-mld -j1 --display short --root .
{1 Library bar}
This library exposes the following toplevel modules:
{!modules:Bar}
The entry point of this library is the module:
{!module-Bar}.