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 );