From a14398303404cbb60b04fc31268373250e8bb3e8 Mon Sep 17 00:00:00 2001 From: Nick Freear Date: Thu, 21 Jul 2016 15:18:58 +0100 Subject: [PATCH] Bug #14, fixes - split/chunk a Moodle course home-page.. [iet:6252860] --- lib/Generator/Html.php | 2 +- lib/Generator/StaticPages.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Generator/Html.php b/lib/Generator/Html.php index d7e7e27..68d57ab 100644 --- a/lib/Generator/Html.php +++ b/lib/Generator/Html.php @@ -172,7 +172,7 @@ public function staticHtml($page) EOT; - if (false === strpos($page->url, 'sideblock') || (isset($page->filename) && false === strpos($page->filename, '-resources-')) ) { + if (false === strpos($page->url, 'sideblock') || (isset($page->filename) && false === strpos($page->filename, '_resources-'))) { $template .= << %json diff --git a/lib/Generator/StaticPages.php b/lib/Generator/StaticPages.php index f664dca..18e9c25 100644 --- a/lib/Generator/StaticPages.php +++ b/lib/Generator/StaticPages.php @@ -212,7 +212,7 @@ protected function putSectionPage($section, $section_html) 'modulename' => 'section', 'filename' => $section_pages[ 'sid:' . $section->id ], 'name' => $section->title, - 'content' => implode('\n', $section_html), + 'content' => implode("\n", $section_html), ]; $sec_page->url = $this->url($sec_page->filename); $filename = $this->output_dir . '/' . $sec_page->filename . '.htm'; @@ -302,7 +302,7 @@ protected function putUrlActivity($url) protected function url($filename) { - return $this->base . preg_replace('/^\-/', '', $filename); + return $this->base . preg_replace('/^[-_\.]/', '', $filename); } protected function putIndex() @@ -343,7 +343,9 @@ protected function putYaml() $yml_post = ": { }\n\n#End.\n"; $yml_join = ": { }\n "; - $bytes = file_put_contents($filename, $yml_pre . implode($yml_join, $this->references) . $yml_post); + $references = array_merge($this->opt('section_pages', []), $this->references); + + $bytes = file_put_contents($filename, $yml_pre . implode($yml_join, $references) . $yml_post); return $bytes; } }