BUGFIX: only strip the last most extension off, rather than from the start.

This commit is contained in:
Will Rossiter 2010-10-29 01:39:45 +00:00
parent 587f557949
commit 8a02cee714
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -199,7 +199,7 @@ class DocumentationParserTest extends SapphireTest {
'Documentation Page',
'Documentation',
'Documentation',
'Documentation',
'Documentation.file',
'.hidden' // don't display something without a title
);