8
0

Extract tree builder

Add related files directly in the documentation
Dieser Commit ist enthalten in:
Stéphane Goetz
2015-04-22 18:24:10 +02:00
committet von Stéphane Goetz
Ursprung 2c228273fb
Commit ecd5efe758
23 geänderte Dateien mit 327 neuen und 304 gelöschten Zeilen

Datei anzeigen

@ -3,6 +3,8 @@
use Todaymade\Daux\Daux;
use Todaymade\Daux\Entry;
use Todaymade\Daux\MarkdownPage;
use Todaymade\Daux\Tree\Directory;
use Todaymade\Daux\Tree\Content;
class Generator {
public function generate($global_config, $destination) {
@ -26,16 +28,18 @@ class Generator {
$params['image'] = str_replace('<base_url>', $base_url, $params['image']);
if ($base_url !== '') $params['entry_page'] = $tree->first_page;
foreach ($tree->value as $key => $node) {
if ($node->type === Entry::DIRECTORY_TYPE) {
if ($node instanceof Directory) {
$new_output_dir = $output_dir . DIRECTORY_SEPARATOR . $key;
@mkdir($new_output_dir);
$this->recursive_generate_static($node, $new_output_dir, $new_params, '../' . $base_url);
} else {
} else if ($node instanceof Content) {
$params['request'] = $node->get_url();
$params['file_uri'] = $node->name;
$page = MarkdownPage::fromFile($node, $params);
file_put_contents($output_dir . DIRECTORY_SEPARATOR . $key, $page->get_page_content());
} else {
copy($node->local_path, $output_dir . DIRECTORY_SEPARATOR . $key);
}
}
}

Datei anzeigen

@ -8,8 +8,8 @@ class Helper {
@mkdir($path);
static::clean_directory($path);
@mkdir($path . DIRECTORY_SEPARATOR . 'img');
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'img', $path . DIRECTORY_SEPARATOR . 'img');
@mkdir($path . DIRECTORY_SEPARATOR . 'resources');
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'resources', $path . DIRECTORY_SEPARATOR . 'resources');
@mkdir($path . DIRECTORY_SEPARATOR . 'js');
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'js', $path . DIRECTORY_SEPARATOR . 'js');
//added and changed these in order to fetch the theme files and put them in the right place