Skip to content

Commit 10cdc58

Browse files
committed
Fix rendering of sidebar in modules
1 parent 8152b86 commit 10cdc58

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

src/document/sidebar.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ end = struct
6060
in
6161
let f name =
6262
match name with
63-
| Some url, _ when prune && is_prefix (parent url) current_url -> None
63+
| Some url, _ when prune && not (is_prefix (parent url) current_url) ->
64+
None
6465
| v -> Some (convert v)
6566
in
6667
let root_entry = convert tree.Tree.node in

test/roots_and_hierarchy/sidebar.t/run.t

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,22 @@
3737
</ul>
3838
</nav>
3939

40-
$ cat html/pkg/libname/Unit/index.html | grep odoc-global-toc -A 15
40+
$ cat html/pkg/libname/Unit/X/index.html | grep odoc-global-toc -A 15
4141
<nav class="odoc-toc odoc-global-toc">
4242
<ul class="odoc-modules">
4343
<li><b>Library <code>libname</code></b>
44-
<ul><li><a href="#" class="current_unit">Unit</a></li></ul>
45-
</li>
46-
</ul><b>Documentation</b>
47-
<ul class="odoc-pages">
48-
<li><a href="../../index.html">Package <code>pkg</code></a>
4944
<ul>
50-
<li><a href="../../dir1/index.html">A directory</a>
51-
<ul><li><a href="../../dir1/my_page.html">My page</a></li></ul>
52-
</li><li><a href="../../file.html">File</a></li>
45+
<li><a href="../index.html">Unit</a>
46+
<ul>
47+
<li><a href="#" class="current_unit">X</a>
48+
<ul><li><a href="Y/index.html">Y</a></li>
49+
<li><a href="#module-Z">Z</a></li>
50+
</ul>
51+
</li>
52+
</ul>
53+
</li>
5354
</ul>
5455
</li>
55-
</ul>
56-
</nav>
56+
</ul><b>Documentation</b>
5757

5858
$ odoc support-files -o html
59-
$ cp -r html /tmp/html
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
let x = 1
2+
3+
module X = struct
4+
5+
module Y = struct
6+
7+
type t = int
8+
9+
end
10+
11+
module Z = Y
12+
end
13+

0 commit comments

Comments
 (0)