Create a "daux" binary

Refactored Daux a bit to allow generating documentation from working directory
This commit is contained in:
Stéphane Goetz
2016-07-27 23:27:51 +02:00
parent 4f5bc217e7
commit 3375f8ff2b
15 changed files with 164 additions and 71 deletions

View File

@ -17,7 +17,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
return false;
}
if ($this->params['multilanguage']) {
if ($this->params->isMultilanguage()) {
return $this->file->getParent()->getParent() instanceof Root;
}
@ -29,7 +29,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
$this->homepage = $this->isHomepage();
$this->language = '';
if ($this->params['multilanguage'] && count($this->file->getParents())) {
if ($this->params->isMultilanguage() && count($this->file->getParents())) {
$language_dir = $this->file->getParents()[0];
$this->language = $language_dir->getName();
}
@ -63,7 +63,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
$entry_page = [];
if ($this->homepage) {
if ($params['multilanguage']) {
if ($params->isMultilanguage()) {
foreach ($params['languages'] as $key => $name) {
$entry_page[$name] = $params['base_page'] . $params['entry_page'][$key]->getUrl();
}
@ -89,7 +89,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
];
if ($page['breadcrumbs']) {
$page['breadcrumb_trail'] = $this->getBreadcrumbTrail($this->file->getParents(), $params['multilanguage']);
$page['breadcrumb_trail'] = $this->getBreadcrumbTrail($this->file->getParents(), $params->isMultilanguage());
$page['breadcrumb_separator'] = $params['html']['breadcrumb_separator'];
}

View File

@ -15,9 +15,14 @@ class Template
*/
public function __construct($base, $theme)
{
// Use templates from the phar archive if the templates dir doesn't exist.
// Use internal templates or the ones in the phar
// archive if no templates dir exists in the working directory
if (!is_dir($base)) {
$base = 'phar://daux.phar/templates';
if (is_dir(__DIR__ . '/../../../templates')) {
$base = __DIR__ . '/../../../templates';
} else {
$base = 'phar://daux.phar/templates';
}
}
// Create new Plates instance