mirror of
https://github.com/til-schneider/slim-wiki.git
synced 2025-10-21 11:36:05 +02:00
Made .md
extension optional
This commit is contained in:
@@ -12,10 +12,16 @@ class Main {
|
||||
$articleBaseDir = realpath(__DIR__ . '/../../articles') . '/';
|
||||
$articleFilename = $articleBaseDir . implode('/', $requestPathArray);
|
||||
|
||||
// Support `index.md` for directories
|
||||
if (is_dir($articleFilename)) {
|
||||
$articleFilename = rtrim($articleFilename, '/') . '/index.md';
|
||||
}
|
||||
|
||||
// Make the extension `.md` optional
|
||||
if (! file_exists($articleFilename) && file_exists($articleFilename . '.md')) {
|
||||
$articleFilename .= '.md';
|
||||
}
|
||||
|
||||
if (($articleFilename == realpath($articleFilename)) && file_exists($articleFilename) && is_readable($articleFilename)) {
|
||||
$wikiName = 'Slim Wiki'; // TODO: Make this configurable
|
||||
|
||||
|
Reference in New Issue
Block a user