diff --git a/libs/functions.php b/libs/functions.php index 6594e8b..76d7f97 100755 --- a/libs/functions.php +++ b/libs/functions.php @@ -148,34 +148,18 @@ } // Generate Documentation from Markdown file - function generate_page($file, $with_index="") { + function generate_page($file) { global $base, $base_doc, $base_path, $docs_path, $options, $mode, $relative_base; $template = $options['template']; $file_relative_path = str_replace($docs_path . '/', "", $file); if ($file_relative_path === 'index.md') $homepage = TRUE; else $homepage = FALSE; if (!$file) { - if (file_get_contents($with_index) === FALSE) { - $page['path'] = ''; - $page['markdown'] = ''; - $page['title'] = 'Oh No'; - $page['content'] = "

Oh No. That page doesn't exist

"; - $options['file_editor'] = false; - } else { - $file_relative_path = str_replace($docs_path . '/', "", $with_index); - $page['path'] = $file_relative_path; - $page['markdown'] = file_get_contents($with_index); - $page['modified'] = filemtime($with_index); - - $Parsedown = new Parsedown(); - $page['content'] = $Parsedown->text($page['markdown']); - - if ($options['breadcrumbs']) { - $page['title'] = url_to_title(get_url($with_index), 'Colons'); - } else { - $page['title'] = clean_url($with_index, 'Title'); - } - } + $page['path'] = ''; + $page['markdown'] = ''; + $page['title'] = 'Oh No'; + $page['content'] = "

Oh No. That page doesn't exist

"; + $options['file_editor'] = false; } else { $page['path'] = $file_relative_path; $page['markdown'] = file_get_contents($file); diff --git a/libs/live.php b/libs/live.php index 72c76f2..0cc0e9a 100644 --- a/libs/live.php +++ b/libs/live.php @@ -8,11 +8,8 @@ $output_language = $b[0]; } $file = clean_url_to_file($page); - if (!is_file($file)) { - $index = clean_url_to_file($page . "index.md"); - $file = FALSE; - } - return generate_page($file, $index); + if (!is_file($file)) $file = FALSE; + return generate_page($file); } // Clean Live Url @@ -36,8 +33,8 @@ else { if (empty($options['languages'])) return $base_doc; else { - $t = array_keys($base_doc); - return $base_doc[$t[0]]; + $t = array_keys($base_doc); + return $base_doc[$t[0]]; } } } else {