diff --git a/syntax.php b/syntax.php
index ec96be5..362a4b1 100644
--- a/syntax.php
+++ b/syntax.php
@@ -38,7 +38,7 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin {
}
function connectTo ($mode) {
- $this->Lexer->addSpecialPattern('{{indexmenu_n>(\d+)}}',$mode,'plugin_navigation');
+ $this->Lexer->addSpecialPattern('{{indexmenu>.+?}}',$mode,'plugin_navigation');
$this->Lexer->addSpecialPattern ('\[Navigation\]', $mode, 'plugin_navigation');
}
@@ -70,15 +70,16 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin {
}
});
- $content = '
';
-
- $iter->all(function(DokuWikiNode $node) use (&$content){
- if ($node->getName() != 'root') {
- $content .= '- ' . $node->getFullID() . ':' . $node->getMetaData('sortorder') . '
';
+ $root = $iter->getRoot();
+ $content = '';
+ if ($root instanceof DokuWikiNameSpace) {
+ $nodes = $root->getNodes();
+ if ($nodes->count() > 0) {
+ $content .= '';
+ $content .= $this->RenderNodes($root);
+ $content .= '
';
}
- });
-
- $content .= '
';
+ }
// $data is what the function handle return'ed.
if ($mode == 'xhtml') {
@@ -87,4 +88,17 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin {
}
return false;
}
+
+ private function RenderNodes(DokuWikiNameSpace $node) {
+ $output = '';
+ foreach ($node->getNodes() as $node) {
+ /** @var DokuWikiNode $node */
+ if ($node instanceof DokuWikiPage) {
+ $output .= '' . $node->getName() . '';
+ } else {
+ $output .= '' . $node->getName() . '' . $this->RenderNodes($node) . '
';
+ }
+ }
+ return $output;
+ }
}
\ No newline at end of file