Skip to content

Commit 0e67109

Browse files
committed
When generating a hidden module, mention why it is empty.
Signed-off-by: Paul-Elliot <[email protected]>
1 parent 4011e9d commit 0e67109

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

src/odoc/odoc_link.ml

+31-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,44 @@ let link_page ~resolver ~filename page =
44
let env = Resolver.build_env_for_page resolver page in
55
Odoc_xref2.Link.resolve_page ~filename env page
66

7+
let content_for_hidden_modules =
8+
let open Odoc_model in
9+
let open Lang.Signature in
10+
let with_loc v =
11+
let open Location_ in
12+
{
13+
location =
14+
{
15+
file = "_none_";
16+
start = { line = 1; column = 0 };
17+
end_ = { line = 1; column = 0 };
18+
};
19+
value = v;
20+
}
21+
in
22+
let sentence =
23+
[
24+
`Word "This";
25+
`Space;
26+
`Word "module";
27+
`Space;
28+
`Word "is";
29+
`Space;
30+
`Word "hidden.";
31+
]
32+
in
33+
[ Comment (`Docs [ with_loc @@ `Paragraph (List.map with_loc sentence) ]) ]
34+
735
let link_unit ~resolver ~filename m =
836
let open Odoc_model in
937
let open Lang.Compilation_unit in
1038
let m =
1139
if Root.Odoc_file.hidden m.root.file then
1240
{
1341
m with
14-
content = Module { items = []; compiled = false; doc = [] };
42+
content =
43+
Module
44+
{ items = content_for_hidden_modules; compiled = false; doc = [] };
1545
expansion = None;
1646
}
1747
else m

test/xref2/module_preamble.t/run.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@ and that "hidden" modules (eg. `A__b`, rendered to `html/A__b`) are not rendered
122122
</nav>
123123
<header class="odoc-preamble">
124124
<h1>Module <code><span>A__b</span></code></h1>
125-
</header><div class="odoc-content"></div>
125+
</header><div class="odoc-content"><p>This module is hidden.</p></div>
126126
</body>
127127
</html>

0 commit comments

Comments
 (0)