Merge pull request #1290 from gollum/fix_1274

Pagename() function no longer returns file extension. Fixes #1274.
This commit is contained in:
Bart Kamphorst
2018-02-05 13:29:11 +01:00
committed by GitHub
@@ -1,8 +1,14 @@
// Helpers
function pageName(){
// "my/dir/file" => "file"
return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').pop();
// "my/dir/file.md" => "file"
if (typeof(pageFullPath) == 'undefined') {
return undefined;
} else {
name = pageFullPath.split('/').pop();
return name.substring(0, name.lastIndexOf('.'));
}
}
function pagePath(){
// "my/dir/file" => "my/dir"
return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').slice(0,-1).join('/');