From f19abc6cc693b7a7952cf3f951173e6d0823b7ad Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 6 Jun 2014 12:08:13 +0200 Subject: [PATCH] highlight the current item. --- style.css | 3 +++ syntax.php | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100755 style.css diff --git a/style.css b/style.css new file mode 100755 index 0000000..a68e5af --- /dev/null +++ b/style.css @@ -0,0 +1,3 @@ +ul.navigation li a.active { + font-weight: bold; +} \ No newline at end of file diff --git a/syntax.php b/syntax.php index a9a09e0..16b96af 100755 --- a/syntax.php +++ b/syntax.php @@ -76,9 +76,12 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin } return false; } + global $INFO; + $iter = new DokuWikiIterator(); - $iter->all(function (DokuWikiNode $node) { + $iter->all(function (DokuWikiNode $node) use($INFO) { + $node->setMetaData('active',$node->getFullID() == $INFO['id']); if (preg_match('/{{indexmenu_n>(\d+)}}/', $node->getContent(), $matches)) { $node->setMetaData('sortorder', $matches[1]); } else { @@ -102,7 +105,7 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin if ($root instanceof DokuWikiNameSpace) { $nodes = $root->getNodes(); if ($nodes->count() > 0) { - $content .= '