8
0
Dieser Commit ist enthalten in:
Stéphane Goetz 2015-07-18 21:23:02 +02:00
Ursprung aa5602a0fb
Commit 7dc7c045d4
10 geänderte Dateien mit 22 neuen und 18 gelöschten Zeilen

BIN
daux.phar

Binäre Datei nicht angezeigt.

1
generate.php → generate Normale Datei → Ausführbare Datei
Datei anzeigen

@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
/*

Datei anzeigen

@ -109,9 +109,9 @@ class Compiler
private function addBinary($phar)
{
$content = file_get_contents(__DIR__ . '/../generate.php');
//$content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
$phar->addFromString('generate.php', $content);
$content = file_get_contents(__DIR__ . '/../generate');
$content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
$phar->addFromString('generate', $content);
}
/**
@ -166,7 +166,7 @@ define('PHAR_DIR', dirname(__FILE__));
Phar::mapPhar('daux.phar');
require 'phar://daux.phar/generate.php';
require 'phar://daux.phar/generate';
__HALT_COMPILER();
EOF;

Datei anzeigen

@ -98,7 +98,7 @@ class DauxHelper
*
* @param Directory $tree
* @param string $request
* @return Tree\Entry|false
* @return Tree\Content|Tree\Raw
*/
public static function getFile($tree, $request)
{

Datei anzeigen

@ -20,12 +20,16 @@ class MarkdownPage extends \Todaymade\Daux\Format\Base\MarkdownPage
$this->language = '';
if ($this->params['multilanguage'] && count($this->file->getParents())) {
reset($this->file->getParents());
$language_dir = current($this->file->getParents());
$this->language = $language_dir->name;
$language_dir = $this->file->getParents()[0];
$this->language = $language_dir->getName();
}
}
/**
* @param \Todaymade\Daux\Tree\Directory[] $parents
* @param bool $multilanguage
* @return array
*/
private function getBreadcrumbTrail($parents, $multilanguage)
{
if ($multilanguage && !empty($parents)) {

Datei anzeigen

@ -25,7 +25,7 @@ class Helper
*
* @param string $dir
*/
private static function rmdir($dir)
protected static function rmdir($dir)
{
$it = new \RecursiveDirectoryIterator($dir);
$files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
@ -47,7 +47,7 @@ class Helper
* @param string $source
* @param string $destination
*/
private static function copyRecursive($source, $destination)
protected static function copyRecursive($source, $destination)
{
if (!is_dir($destination)) {
mkdir($destination);

Datei anzeigen

@ -5,7 +5,6 @@ use Todaymade\Daux\DauxHelper;
use Todaymade\Daux\Exception;
use Todaymade\Daux\Format\HTML\MarkdownPage;
use Todaymade\Daux\Format\HTML\RawPage;
use Todaymade\Daux\Format\HTML\SimplePage;
use Todaymade\Daux\Tree\Raw;
class Server

Datei anzeigen

@ -38,7 +38,6 @@ class Builder
continue;
}
$entry = null;
if (is_dir($path)) {
$new = new Directory($node, static::getUriFromFilename(static::getFilename($path)), $path);
$new->setName(DauxHelper::pathinfo($path)['filename']);

Datei anzeigen

@ -37,11 +37,11 @@ abstract class Entry
$this->setUri($uri);
$this->setParent($parent);
if ($path) {
if ($path !== null) {
$this->path = $path;
}
if ($last_modified) {
if ($last_modified !== null) {
$this->last_modified = $last_modified;
}
}
@ -118,7 +118,8 @@ abstract class Entry
// First we try to find a real page
foreach ($this->getEntries() as $node) {
if ($node instanceof Content) {
if (!$node->getParent() && $node->title == 'index') {
// TODO :: this condition looks weird ...
if (!$node->getParent() && $node->getTitle() == 'index') {
//the homepage should not count as first page
continue;
}
@ -174,7 +175,7 @@ abstract class Entry
/**
* Return all parents starting with the root
*
* @return array<Directory>
* @return Directory[]
*/
public function getParents()
{
@ -231,7 +232,7 @@ abstract class Entry
'name' => $this->getName(),
'uri' => $this->getUri(),
'url' => $this->getUrl(),
'index' => $this->getIndexPage()? $this->getIndexPage()->getUrl() : '',
'index' => $this->getIndexPage() ? $this->getIndexPage()->getUrl() : '',
'first' => $this->getFirstPage() ? $this->getFirstPage()->getUrl() : '',
'path' => $this->path
];

Datei anzeigen

@ -5,7 +5,7 @@ class Root extends Directory
/**
* The root doesn't have a parent
*
* @param Directory $uri
* @param string $uri
*/
public function __construct($uri)
{