Fix static reference to theme in generated documentation

Cette révision appartient à :
Stéphane Goetz 2015-04-23 15:47:05 +02:00 révisé par Stéphane Goetz
Parent 52b679b33f
révision 6edd4ce477
4 fichiers modifiés avec 25 ajouts et 9 suppressions

Voir le fichier

@ -116,6 +116,7 @@ class Daux
'multilanguage' => !empty($this->options['languages']),
//Paths and tree
'theme-name' => $this->options['theme'],
'mode' => $this->mode,
'local_base' => $this->local_base,
'docs_path' => $this->docs_path,
@ -151,10 +152,10 @@ class Daux
}
$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'],
$this->local_base,
$params['base_url'] . "resources/themes/" . $this->options['theme'] . '/'
$params['base_url'] . "resources/themes/" . $this->options['theme-name'] . '/'
);
return $params;

Voir le fichier

@ -1,6 +1,7 @@
<?php namespace Todaymade\Daux\Generator;
use Todaymade\Daux\Daux;
use Todaymade\Daux\DauxHelper;
use Todaymade\Daux\MarkdownPage;
use Todaymade\Daux\Tree\Directory;
use Todaymade\Daux\Tree\Content;
@ -17,16 +18,26 @@ class Generator
$destination = $daux->local_base . DS . 'static';
}
echo "Copying Static assets ...\n";
Helper::copyAssets($destination, $daux->local_base);
echo "Generating ...\n";
$this->generateRecursive($daux->tree, $destination, $params);
echo "Done !\n";
}
private function generateRecursive($tree, $output_dir, $params, $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']);
if ($base_url !== '') {
$params['entry_page'] = $tree->getFirstPage();
@ -35,14 +46,16 @@ class Generator
if ($node instanceof Directory) {
$new_output_dir = $output_dir . DS . $key;
@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) {
echo "- " . $node->getUrl() . "\n";
$params['request'] = $node->getUrl();
$params['file_uri'] = $node->getName();
$page = MarkdownPage::fromFile($node, $params);
file_put_contents($output_dir . DS . $key, $page->getContent());
} else {
echo "- " . $node->getUrl() . "\n";
copy($node->getPath(), $output_dir . DS . $key);
}
}

Voir le fichier

@ -28,19 +28,19 @@ class MarkdownPage extends SimplePage
$this->params = $params;
$this->title = $file->title;
$this->homepage = false;
if ($this->title === 'index') {
$this->homepage = ($this->file->getName() === '_index');
$minimum_parent_dir_size = ($params['multilanguage']) ? 2 : 1;
if (count($file->getParents()) >= $minimum_parent_dir_size) {
$parents = $file->getParents();
$parent = end($parents);
$this->title = $parent->getTitle();
} else {
$this->homepage = ($this->file->getName() === '_index');
$this->title = $params['title'];
}
} else {
$this->homepage = false;
}
if ($params['breadcrumbs']) {
$this->breadcrumb_trail = $this->buildBreadcrumbTrail($file->getParents(), $params['multilanguage']);
}
@ -105,6 +105,7 @@ class MarkdownPage extends SimplePage
$page['path'] = $this->file->getPath();
$page['modified_time'] = filemtime($this->file->getPath());
$page['markdown'] = $this->content;
$page['request'] = $params['request'];
$Parsedown = new \Parsedown();
$page['content'] = $Parsedown->text($this->content);

Voir le fichier

@ -26,7 +26,8 @@
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']);
?>
<?php if (!empty($params['links']) || !empty($params['twitter'])) { ?>
<?php if (!empty($params['links']) || !empty($params['twitter']) || $params['toggle_code']) { ?>
<div class="well well-sidebar">
<!-- Links -->