Fix static reference to theme in generated documentation
This commit is contained in:
parent
52b679b33f
commit
6edd4ce477
@ -116,6 +116,7 @@ class Daux
|
|||||||
'multilanguage' => !empty($this->options['languages']),
|
'multilanguage' => !empty($this->options['languages']),
|
||||||
|
|
||||||
//Paths and tree
|
//Paths and tree
|
||||||
|
'theme-name' => $this->options['theme'],
|
||||||
'mode' => $this->mode,
|
'mode' => $this->mode,
|
||||||
'local_base' => $this->local_base,
|
'local_base' => $this->local_base,
|
||||||
'docs_path' => $this->docs_path,
|
'docs_path' => $this->docs_path,
|
||||||
@ -151,10 +152,10 @@ class Daux
|
|||||||
}
|
}
|
||||||
|
|
||||||
$params['theme'] = DauxHelper::getTheme(
|
$params['theme'] = DauxHelper::getTheme(
|
||||||
$this->local_base . DS . 'resources' . DS . 'themes' . DS . $this->options['theme'],
|
$this->local_base . DS . 'resources' . DS . 'themes' . DS . $this->options['theme-name'],
|
||||||
$params['base_url'],
|
$params['base_url'],
|
||||||
$this->local_base,
|
$this->local_base,
|
||||||
$params['base_url'] . "resources/themes/" . $this->options['theme'] . '/'
|
$params['base_url'] . "resources/themes/" . $this->options['theme-name'] . '/'
|
||||||
);
|
);
|
||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php namespace Todaymade\Daux\Generator;
|
<?php namespace Todaymade\Daux\Generator;
|
||||||
|
|
||||||
use Todaymade\Daux\Daux;
|
use Todaymade\Daux\Daux;
|
||||||
|
use Todaymade\Daux\DauxHelper;
|
||||||
use Todaymade\Daux\MarkdownPage;
|
use Todaymade\Daux\MarkdownPage;
|
||||||
use Todaymade\Daux\Tree\Directory;
|
use Todaymade\Daux\Tree\Directory;
|
||||||
use Todaymade\Daux\Tree\Content;
|
use Todaymade\Daux\Tree\Content;
|
||||||
@ -17,16 +18,26 @@ class Generator
|
|||||||
$destination = $daux->local_base . DS . 'static';
|
$destination = $daux->local_base . DS . 'static';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Copying Static assets ...\n";
|
||||||
Helper::copyAssets($destination, $daux->local_base);
|
Helper::copyAssets($destination, $daux->local_base);
|
||||||
|
|
||||||
|
echo "Generating ...\n";
|
||||||
$this->generateRecursive($daux->tree, $destination, $params);
|
$this->generateRecursive($daux->tree, $destination, $params);
|
||||||
|
echo "Done !\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRecursive($tree, $output_dir, $params, $base_url = '')
|
private function generateRecursive($tree, $output_dir, $params, $base_url = '')
|
||||||
{
|
{
|
||||||
$params['base_url'] = $params['base_page'] = $base_url;
|
$params['base_url'] = $params['base_page'] = $base_url;
|
||||||
$new_params = $params;
|
|
||||||
//
|
// Rebase Theme
|
||||||
|
$params['theme'] = DauxHelper::getTheme(
|
||||||
|
$params['local_base'] . DS . 'resources' . DS . 'themes' . DS . $params['theme-name'],
|
||||||
|
$base_url,
|
||||||
|
$params['local_base'],
|
||||||
|
$params['base_url'] . "resources/themes/" . $params['theme-name'] . '/'
|
||||||
|
);
|
||||||
|
|
||||||
$params['image'] = str_replace('<base_url>', $base_url, $params['image']);
|
$params['image'] = str_replace('<base_url>', $base_url, $params['image']);
|
||||||
if ($base_url !== '') {
|
if ($base_url !== '') {
|
||||||
$params['entry_page'] = $tree->getFirstPage();
|
$params['entry_page'] = $tree->getFirstPage();
|
||||||
@ -35,14 +46,16 @@ class Generator
|
|||||||
if ($node instanceof Directory) {
|
if ($node instanceof Directory) {
|
||||||
$new_output_dir = $output_dir . DS . $key;
|
$new_output_dir = $output_dir . DS . $key;
|
||||||
@mkdir($new_output_dir);
|
@mkdir($new_output_dir);
|
||||||
$this->generateRecursive($node, $new_output_dir, $new_params, '../' . $base_url);
|
$this->generateRecursive($node, $new_output_dir, $params, '../' . $base_url);
|
||||||
} elseif ($node instanceof Content) {
|
} elseif ($node instanceof Content) {
|
||||||
|
echo "- " . $node->getUrl() . "\n";
|
||||||
$params['request'] = $node->getUrl();
|
$params['request'] = $node->getUrl();
|
||||||
$params['file_uri'] = $node->getName();
|
$params['file_uri'] = $node->getName();
|
||||||
|
|
||||||
$page = MarkdownPage::fromFile($node, $params);
|
$page = MarkdownPage::fromFile($node, $params);
|
||||||
file_put_contents($output_dir . DS . $key, $page->getContent());
|
file_put_contents($output_dir . DS . $key, $page->getContent());
|
||||||
} else {
|
} else {
|
||||||
|
echo "- " . $node->getUrl() . "\n";
|
||||||
copy($node->getPath(), $output_dir . DS . $key);
|
copy($node->getPath(), $output_dir . DS . $key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,19 +28,19 @@ class MarkdownPage extends SimplePage
|
|||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
$this->title = $file->title;
|
$this->title = $file->title;
|
||||||
|
|
||||||
|
$this->homepage = false;
|
||||||
if ($this->title === 'index') {
|
if ($this->title === 'index') {
|
||||||
$this->homepage = ($this->file->getName() === '_index');
|
|
||||||
$minimum_parent_dir_size = ($params['multilanguage']) ? 2 : 1;
|
$minimum_parent_dir_size = ($params['multilanguage']) ? 2 : 1;
|
||||||
if (count($file->getParents()) >= $minimum_parent_dir_size) {
|
if (count($file->getParents()) >= $minimum_parent_dir_size) {
|
||||||
$parents = $file->getParents();
|
$parents = $file->getParents();
|
||||||
$parent = end($parents);
|
$parent = end($parents);
|
||||||
$this->title = $parent->getTitle();
|
$this->title = $parent->getTitle();
|
||||||
} else {
|
} else {
|
||||||
|
$this->homepage = ($this->file->getName() === '_index');
|
||||||
$this->title = $params['title'];
|
$this->title = $params['title'];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->homepage = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($params['breadcrumbs']) {
|
if ($params['breadcrumbs']) {
|
||||||
$this->breadcrumb_trail = $this->buildBreadcrumbTrail($file->getParents(), $params['multilanguage']);
|
$this->breadcrumb_trail = $this->buildBreadcrumbTrail($file->getParents(), $params['multilanguage']);
|
||||||
}
|
}
|
||||||
@ -105,6 +105,7 @@ class MarkdownPage extends SimplePage
|
|||||||
$page['path'] = $this->file->getPath();
|
$page['path'] = $this->file->getPath();
|
||||||
$page['modified_time'] = filemtime($this->file->getPath());
|
$page['modified_time'] = filemtime($this->file->getPath());
|
||||||
$page['markdown'] = $this->content;
|
$page['markdown'] = $this->content;
|
||||||
|
$page['request'] = $params['request'];
|
||||||
|
|
||||||
$Parsedown = new \Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
$page['content'] = $Parsedown->text($this->content);
|
$page['content'] = $Parsedown->text($this->content);
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
if ($page['language'] !== '') echo $this->get_navigation($tree->value[$page['language']], $page['language'], $params['request'], $base_page, $params['mode']);
|
if ($page['language'] !== '') echo $this->get_navigation($tree->value[$page['language']], $page['language'], $params['request'], $base_page, $params['mode']);
|
||||||
else echo $this->get_navigation($tree, '', $params['request'], $base_page, $params['mode']);
|
else echo $this->get_navigation($tree, '', $params['request'], $base_page, $params['mode']);
|
||||||
?>
|
?>
|
||||||
<?php if (!empty($params['links']) || !empty($params['twitter'])) { ?>
|
|
||||||
|
<?php if (!empty($params['links']) || !empty($params['twitter']) || $params['toggle_code']) { ?>
|
||||||
<div class="well well-sidebar">
|
<div class="well well-sidebar">
|
||||||
|
|
||||||
<!-- Links -->
|
<!-- Links -->
|
||||||
|
Loading…
Reference in New Issue
Block a user