From 7bbe108106476ad3af67ddc651c02a9d9e9cbebe Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Fri, 6 Jun 2014 13:27:47 +0200 Subject: [PATCH] If no sortorder is specified, use alphabetic sorting. For details see http://www.php.net/manual/de/function.strnatcasecmp.php --- syntax.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax.php b/syntax.php index 9e3bada..15d7f46 100755 --- a/syntax.php +++ b/syntax.php @@ -93,7 +93,9 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin if ($node instanceof DokuWikiNameSpace) { $node->nodes->uasort(function (DokuWikiNode $a, DokuWikiNode $b) { if ($a->getMetaData('sortorder') == $b->getMetaData('sortorder')) { - return 0; + $title_a = (strlen($a->getMetaData('title')) > 0 ? $a->getMetaData('title') : $a->getName()); + $title_b = (strlen($b->getMetaData('title')) > 0 ? $b->getMetaData('title') : $b->getName()); + return strnatcasecmp($title_a,$title_b); } return ($a->getMetaData('sortorder') < $b->getMetaData('sortorder')) ? -1 : 1; });