We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a90dd3b commit b2e0058Copy full SHA for b2e0058
src/Twig/TocExtension.php
@@ -24,10 +24,16 @@ public function getFunctions(): array
24
public static function getOptions(array $toc): array
25
{
26
$flattendToc = self::flattenToc($toc);
27
- $maxDepth = 0;
+ // FIXME: this hardcoded '2' value should instead be obtained
28
+ // automatically using the 'maxdepth' option of 'toctree' directive.
29
+ // See https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html
30
+ $maxDepth = 2;
31
$numVisibleItems = 0;
32
foreach ($flattendToc as $tocItem) {
- $maxDepth = max($maxDepth, $tocItem['level']);
33
+ if ($tocItem['level'] > $maxDepth) {
34
+ continue;
35
+ }
36
+
37
$numVisibleItems++;
38
}
39
0 commit comments