From ae8dfc454e64c385e6fb65abf28fb03def33c218 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Thu, 14 Nov 2024 20:21:14 +0000 Subject: [PATCH] Fix rendering of sidebar in modules --- src/document/sidebar.ml | 2 +- test/roots_and_hierarchy/sidebar.t/run.t | 23 +++++++++++----------- test/roots_and_hierarchy/sidebar.t/unit.ml | 12 +++++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/document/sidebar.ml b/src/document/sidebar.ml index d45fa79df2..06e469c851 100644 --- a/src/document/sidebar.ml +++ b/src/document/sidebar.ml @@ -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 diff --git a/test/roots_and_hierarchy/sidebar.t/run.t b/test/roots_and_hierarchy/sidebar.t/run.t index f8fb9c9c23..8c0ec9d6b2 100644 --- a/test/roots_and_hierarchy/sidebar.t/run.t +++ b/test/roots_and_hierarchy/sidebar.t/run.t @@ -37,23 +37,22 @@ - $ 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 + Documentation $ odoc support-files -o html -$ cp -r html /tmp/html diff --git a/test/roots_and_hierarchy/sidebar.t/unit.ml b/test/roots_and_hierarchy/sidebar.t/unit.ml index 0547b3d0ee..22dfecdc23 100644 --- a/test/roots_and_hierarchy/sidebar.t/unit.ml +++ b/test/roots_and_hierarchy/sidebar.t/unit.ml @@ -1 +1,13 @@ let x = 1 + +module X = struct + + module Y = struct + + type t = int + + end + + module Z = Y +end +