Skip to content

Commit b0649a0

Browse files
wouterjlinawolf
authored andcommitted
Fix maxdepth with glob
1 parent fd0c84b commit b0649a0

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

packages/guides/src/Compiler/NodeTransformers/MenuNodeTransformers/GlobMenuEntryNodeTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function handleMenuEntry(MenuNode $currentMenu, MenuEntryNode $entryNo
7676
self::isInRootline($documentEntry, $compilerContext->getDocumentNode()->getDocumentEntry()),
7777
self::isCurrent($documentEntry, $currentPath),
7878
);
79-
if (!$currentMenu->hasOption('titlesonly')) {
79+
if (!$currentMenu->hasOption('titlesonly') && $maxDepth > 1) {
8080
$this->addSubSectionsToMenuEntries($documentEntry, $newEntryNode, $maxDepth - 1);
8181
}
8282

tests/Integration/tests/toctree/toctree-maxdepth/expected/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ <h1>Index</h1>
240240

241241
</ul></li>
242242

243+
</ul>
244+
</div>
245+
<p>Glob</p>
246+
<div class="toc">
247+
<ul class="menu-level">
248+
<li class="toc-item"><a href="/subpages/page1.html#page-1">Page 1</a></li>
249+
250+
<li class="toc-item"><a href="/subpages/page2.html#page-2">Page 2</a></li>
251+
243252
</ul>
244253
</div>
245254

tests/Integration/tests/toctree/toctree-maxdepth/input/index.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ Maxdepth 5
4141
page1
4242
subpage2/page1
4343

44-
45-
4644
No Maxdepth
4745

4846
.. toctree::
4947

5048
page1
5149
subpage2/page1
50+
51+
Glob
52+
53+
.. toctree::
54+
:glob:
55+
:maxdepth: 1
56+
57+
subpages/*
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Page 1
2+
======
3+
4+
Page 1 Section 1
5+
----------------
6+
7+
Page 1 Section 2
8+
----------------
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Page 2
2+
======
3+
4+
Page 2 Section 1
5+
----------------
6+
7+
Page 2 Section 2
8+
----------------

0 commit comments

Comments
 (0)