diff --git a/syntax.php b/syntax.php index 362a4b1..f1622b8 100644 --- a/syntax.php +++ b/syntax.php @@ -20,6 +20,10 @@ require_once dirname (__FILE__) . DIRECTORY_SEPARATOR . 'objectrepresentation' . */ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin { + // TODO add a config option for this + private $maxDepth = 2; + private $depth = 0; + function getInfo () { return array ('author' => 'Tim Schumacher', 'email' => 'tim@bandenkrieg.hacked.jp', @@ -90,13 +94,16 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin { } private function RenderNodes(DokuWikiNameSpace $node) { + $this->depth++; $output = ''; foreach ($node->getNodes() as $node) { /** @var DokuWikiNode $node */ if ($node instanceof DokuWikiPage) { $output .= '
  • ' . $node->getName() . '
  • '; } else { - $output .= '
  • ' . $node->getName() . '
  • '; + if ($this->depth <= $this->maxDepth) { + $output .= '
  • ' . $node->getName() . '
  • '; + } } } return $output;