Skip to content

Commit

Permalink
Fix rendering of sidebar in modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jonludlam committed Nov 14, 2024
1 parent f6d4441 commit 9f94094
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/document/sidebar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ end = struct
in
let f name =
match name with
| Some url, _ when prune && is_prefix (parent url) current_url -> None
| Some url, _ when prune && not (is_prefix (parent url) current_url) -> None
| v -> Some (convert v)
in
let root_entry = convert tree.Tree.node in
Expand Down
24 changes: 12 additions & 12 deletions test/roots_and_hierarchy/sidebar.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@
</ul>
</nav>

$ cat html/pkg/libname/Unit/index.html | grep odoc-global-toc -A 15
$ cat html/pkg/libname/Unit/X/index.html | grep odoc-global-toc -A 15
<nav class="odoc-toc odoc-global-toc">
<ul class="odoc-modules">
<li><b>Library <code>libname</code></b>
<ul><li><a href="#" class="current_unit">Unit</a></li></ul>
</li>
</ul><b>Documentation</b>
<ul class="odoc-pages">
<li><a href="../../index.html">Package <code>pkg</code></a>
<ul>
<li><a href="../../dir1/index.html">A directory</a>
<ul><li><a href="../../dir1/my_page.html">My page</a></li></ul>
</li><li><a href="../../file.html">File</a></li>
<li><a href="../index.html">Unit</a>
<ul>
<li><a href="#" class="current_unit">X</a>
<ul><li><a href="Y/index.html">Y</a></li>
<li><a href="#module-Z">Z</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
</ul><b>Documentation</b>

$ odoc support-files -o html
$ cp -r html /tmp/html
$ rsync -az html /tmp/
12 changes: 12 additions & 0 deletions test/roots_and_hierarchy/sidebar.t/unit.ml
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
let x = 1

module X = struct

module Y = struct

type t = int

end

module Z = Y
end

0 comments on commit 9f94094

Please sign in to comment.