From 194e77196cfff7b366593073f4be9d6cf3c845c2 Mon Sep 17 00:00:00 2001 From: Gautham Warrier Date: Thu, 13 Mar 2014 14:42:13 +0530 Subject: [PATCH] Generate Index Page from first Doc when missing index.md --- libs/static.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/static.php b/libs/static.php index 70f2d38..0efde5f 100644 --- a/libs/static.php +++ b/libs/static.php @@ -2,7 +2,7 @@ // Generate Static Documentation function generate_static($out_dir) { - global $tree, $base, $docs_path, $output_path, $options, $mode, $multilanguage, $output_language; + global $tree, $base, $base_doc, $docs_path, $output_path, $options, $mode, $multilanguage, $output_language; $mode = 'Static'; if ($out_dir === '') $output_path = $base . '/static'; else { @@ -18,10 +18,15 @@ generate_static_branch($tree[$languageKey], $languageKey); } $index = $docs_path . '/index.md'; - if (is_file($index)) { - $index = generate_page($index); - file_put_contents($output_path . '/index.html', $index); + if (!is_file($index)) { + if (empty($options['languages'])) $index = $base_doc; + else { + $t = array_keys($base_doc); + $index = $base_doc[$t[0]]; + } } + $index = generate_page($index); + file_put_contents($output_path . '/index.html', $index); } // Generate Static Content For Given Directory