Code Style and documentation
This commit is contained in:
@ -32,6 +32,17 @@ class Generator
|
||||
$this->generateRecursive($daux->tree, $destination, $params, $output, $width);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively generate the documentation
|
||||
*
|
||||
* @param \Todaymade\Daux\Tree\Entry $tree
|
||||
* @param string $output_dir
|
||||
* @param \Todaymade\Daux\Config $params
|
||||
* @param OutputInterface $output
|
||||
* @param integer $width
|
||||
* @param string $base_url
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function generateRecursive($tree, $output_dir, $params, $output, $width, $base_url = '')
|
||||
{
|
||||
$params['base_url'] = $params['base_page'] = $base_url;
|
||||
@ -46,7 +57,7 @@ class Generator
|
||||
foreach ($tree->value as $key => $node) {
|
||||
if ($node instanceof Directory) {
|
||||
$new_output_dir = $output_dir . DS . $key;
|
||||
@mkdir($new_output_dir);
|
||||
mkdir($new_output_dir);
|
||||
$this->generateRecursive($node, $new_output_dir, $params, $output, $width, '../' . $base_url);
|
||||
} elseif ($node instanceof Content) {
|
||||
$this->runAction(
|
||||
|
@ -79,6 +79,6 @@ class MarkdownPage extends \Todaymade\Daux\Format\Base\MarkdownPage
|
||||
}
|
||||
|
||||
$template = new Template($params['templates'], $params['theme']['templates']);
|
||||
return $template->render($this->homepage? 'home' : 'content', ['page' => $page, 'params' => $params]);
|
||||
return $template->render($this->homepage ? 'home' : 'content', ['page' => $page, 'params' => $params]);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,10 @@ class Template
|
||||
{
|
||||
protected $engine;
|
||||
|
||||
/**
|
||||
* @param string $base
|
||||
* @param string $theme
|
||||
*/
|
||||
public function __construct($base, $theme)
|
||||
{
|
||||
// Create new Plates instance
|
||||
@ -19,6 +23,11 @@ class Template
|
||||
$this->registerFunctions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function render($name, array $data = array())
|
||||
{
|
||||
$this->engine->addData([
|
||||
@ -94,7 +103,7 @@ class Template
|
||||
$nav[] = [
|
||||
'title' => $node->getTitle(),
|
||||
'href' => $base_page . $link,
|
||||
'class' => ($current_url === $link)? 'active' : ''
|
||||
'class' => ($current_url === $link) ? 'active' : ''
|
||||
];
|
||||
}
|
||||
if ($node instanceof \Todaymade\Daux\Tree\Directory) {
|
||||
@ -102,7 +111,7 @@ class Template
|
||||
|
||||
$folder = [
|
||||
'title' => $node->getTitle(),
|
||||
'class' => (strpos($current_url, $link) === 0)? 'open' : '',
|
||||
'class' => (strpos($current_url, $link) === 0) ? 'open' : '',
|
||||
];
|
||||
|
||||
if ($mode === Daux::STATIC_MODE) {
|
||||
@ -123,6 +132,10 @@ class Template
|
||||
return $nav;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $separator
|
||||
* @return string
|
||||
*/
|
||||
private function getSeparator($separator)
|
||||
{
|
||||
switch ($separator) {
|
||||
|
Verwijs in nieuw issue
Block a user