From 8a02cee7149afe6162440d060c231e1bf635e780 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Fri, 29 Oct 2010 01:39:45 +0000 Subject: [PATCH] BUGFIX: only strip the last most extension off, rather than from the start. --- code/DocumentationParser.php | 6 +++--- tests/DocumentationParserTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/DocumentationParser.php b/code/DocumentationParser.php index 8ba2f5f..40079f0 100644 --- a/code/DocumentationParser.php +++ b/code/DocumentationParser.php @@ -369,17 +369,17 @@ class DocumentationParser { */ public static function clean_page_name($name) { // remove dashs and _ - $name = str_ireplace(array('-', '_'), ' ', $name); + $name = str_replace(array('-', '_'), ' ', $name); // remove extension - $hasExtension = strpos($name, '.'); + $hasExtension = strrpos($name, '.'); if($hasExtension !== false && $hasExtension > 0) { $name = substr($name, 0, $hasExtension); } // convert first letter - return ucfirst($name); + return ucfirst(trim($name)); } diff --git a/tests/DocumentationParserTest.php b/tests/DocumentationParserTest.php index e5ed446..c792c60 100644 --- a/tests/DocumentationParserTest.php +++ b/tests/DocumentationParserTest.php @@ -199,7 +199,7 @@ class DocumentationParserTest extends SapphireTest { 'Documentation Page', 'Documentation', 'Documentation', - 'Documentation', + 'Documentation.file', '.hidden' // don't display something without a title );