mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
BUGFIX: only strip the last most extension off, rather than from the start.
This commit is contained in:
parent
587f557949
commit
8a02cee714
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,7 +199,7 @@ class DocumentationParserTest extends SapphireTest {
|
||||
'Documentation Page',
|
||||
'Documentation',
|
||||
'Documentation',
|
||||
'Documentation',
|
||||
'Documentation.file',
|
||||
'.hidden' // don't display something without a title
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user