Skip to content

Commit 8c8bf89

Browse files
authored
Merge pull request #940 from panglesd/fix-hidden-flag
Fix hidden flag
2 parents 3fb728f + 93a0d2e commit 8c8bf89

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ UNRELEASED
44
Additions
55
- Source code rendering (@Julow, @panglesd, #909)
66

7+
Bugfixes
8+
- Fix `--hidden` not always taken into account (@panglesd, #940)
9+
710
2.2.0
811
-----
912

src/odoc/compile.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ let resolve_imports resolver imports =
107107
imports
108108

109109
(** Raises warnings and errors. *)
110-
let resolve_and_substitute ~resolver ~make_root ~source
110+
let resolve_and_substitute ~resolver ~make_root ~source ~hidden
111111
(parent : Paths.Identifier.ContainerPage.t option) input_file input_type =
112112
let filename = Fs.File.to_string input_file in
113113
(* [impl_shape] is used to lookup locations in the implementation. It is
@@ -135,6 +135,7 @@ let resolve_and_substitute ~resolver ~make_root ~source
135135
in
136136
(unit, None)
137137
in
138+
let unit = { unit with hidden = hidden || unit.hidden } in
138139
let impl_shape =
139140
match cmt_infos with Some (shape, _) -> Some shape | None -> None
140141
in
@@ -330,8 +331,8 @@ let compile ~resolver ~parent_cli_spec ~hidden ~children ~output
330331
let make_root = root_of_compilation_unit ~parent_spec ~hidden ~output in
331332
let result =
332333
Error.catch_errors_and_warnings (fun () ->
333-
resolve_and_substitute ~resolver ~make_root ~source parent input
334-
input_type)
334+
resolve_and_substitute ~resolver ~make_root ~hidden ~source parent
335+
input input_type)
335336
in
336337
(* Extract warnings to write them into the output file *)
337338
let _, warnings = Error.unpack_warnings result in

test/sources/single_mli.t/run.t

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ Similar to Astring library.
1515
$ odoc link -I . a_x.odoc
1616
$ odoc link -I . a.odoc
1717

18-
TODO: It seems that --hidden do not work:
19-
$ odoc_print a_x.odoc | grep hidden
20-
"hidden": "false",
21-
"hidden": "false"
22-
$ odoc_print a_x.odocl | grep hidden
23-
"hidden": "false",
24-
2518
$ odoc html-generate --source a_x.ml --indent -o html a_x.odocl
2619
$ odoc html-generate --source a.ml --indent -o html a.odocl
2720

@@ -35,18 +28,14 @@ Look if all the source files are generated:
3528
html/A/X/Y/index.html
3629
html/A/X/index.html
3730
html/A/index.html
38-
html/A_x
39-
html/A_x/index.html
4031
html/root
4132
html/root/source
4233
html/root/source/a.ml.html
4334
html/root/source/a_x.ml.html
4435

45-
Documentation for `A_x` is not generated for hidden modules, but --hidden do not
46-
work right now:
36+
Documentation for `A_x` is not generated for hidden modules:
4737

4838
$ ! [ -f html/A_x/index.html ]
49-
[1]
5039

5140
Code source for `A_x` is wanted:
5241

0 commit comments

Comments
 (0)