Merge tag '0.7.4' into d3version
Dieser Commit ist enthalten in:
Commit
dbcf67cad9
@ -16,6 +16,7 @@ COPY tipuesearch/ /daux/tipuesearch/
|
||||
COPY global.json /daux/global.json
|
||||
COPY composer.json /daux/composer.json
|
||||
COPY composer.lock /daux/composer.lock
|
||||
COPY index.php /daux/index.php
|
||||
|
||||
# Composer install
|
||||
RUN cd /daux && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
||||
|
@ -97,3 +97,21 @@ The `web.config` needs an entry for `<rewrite>` under `<system.webServer>`:
|
||||
```
|
||||
|
||||
To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, such as [URL Rewriter](http://urlrewriter.net/).
|
||||
|
||||
## Docker
|
||||
|
||||
This is not meant for production use, but you can bundle your documentation in Daux's docker container
|
||||
|
||||
```
|
||||
FROM daux/daux.io
|
||||
|
||||
WORKDIR /daux/
|
||||
COPY docs/ /daux/docs/
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT [ "php", "-S", "0.0.0.0:80", "index.php" ]
|
||||
```
|
||||
|
||||
When you add this to a `Dockerfile` and run `docker build --name my-daux-doc .` and then `docker --rm run -p 8000:80 my-daux-doc`
|
||||
|
||||
You can access your documentation at `localhost:8000`
|
@ -52,7 +52,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
|
||||
if (!empty($parents)) {
|
||||
foreach ($parents as $node) {
|
||||
$page = $node->getIndexPage() ?: $node->getFirstPage();
|
||||
$breadcrumb_trail[$node->getTitle()] = $page ? $page->getUrl() : '';
|
||||
$breadcrumb_trail[] = ['title' => $node->getTitle(), 'url' => $page ? $page->getUrl() : ''];
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
|
||||
$page['breadcrumb_separator'] = $params['html']['breadcrumb_separator'];
|
||||
|
||||
if ($this->homepage) {
|
||||
$page['breadcrumb_trail'] = [$this->file->getTitle() => ''];
|
||||
$page['breadcrumb_trail'] = [['title' => $this->file->getTitle(), 'url' => '']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ class Template
|
||||
$title = '';
|
||||
$breadcrumb_trail = $page['breadcrumb_trail'];
|
||||
$separator = $this->getSeparator($page['breadcrumb_separator']);
|
||||
foreach ($breadcrumb_trail as $key => $value) {
|
||||
$title .= '<a href="' . $base_page . $value . '">' . $key . '</a>' . $separator;
|
||||
foreach ($breadcrumb_trail as $value) {
|
||||
$title .= '<a href="' . $base_page . $value['url'] . '">' . $value['title'] . '</a>' . $separator;
|
||||
}
|
||||
if ($page['filename'] === 'index' || $page['filename'] === '_index') {
|
||||
if ($page['title'] != '') {
|
||||
|
@ -75,10 +75,16 @@ class Builder
|
||||
}
|
||||
|
||||
if ($file->isDir()) {
|
||||
$new = new Directory($node, static::removeSortingInformations($file->getFilename()), $file);
|
||||
$title = static::removeSortingInformations($file->getFilename());
|
||||
$new = new Directory($node, $title, $file);
|
||||
$new->setName(static::getName($file->getPathName()));
|
||||
$new->setTitle(str_replace('_', ' ', static::removeSortingInformations($new->getName())));
|
||||
static::build($new, $ignore);
|
||||
|
||||
$index = $new->getLocalIndexPage();
|
||||
if ($index && $index->getTitle() != $title) {
|
||||
$new->setTitle($index->getTitle());
|
||||
}
|
||||
} else {
|
||||
static::createContent($node, $file);
|
||||
}
|
||||
@ -99,7 +105,7 @@ class Builder
|
||||
$config = $parent->getConfig();
|
||||
|
||||
if (!in_array($file->getExtension(), $config['valid_content_extensions'])) {
|
||||
$uri = static::removeSortingInformations($file->getFilename());
|
||||
$uri = $file->getFilename();
|
||||
|
||||
$entry = new Raw($parent, $uri, $file);
|
||||
$entry->setTitle(str_replace('_', ' ', static::removeSortingInformations($name)));
|
||||
|
@ -125,6 +125,16 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
return $this->parent->getConfig();
|
||||
}
|
||||
|
||||
public function getLocalIndexPage() {
|
||||
$index_key = $this->getConfig()['index_key'];
|
||||
|
||||
if (isset($this->children[$index_key])) {
|
||||
return $this->children[$index_key];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Content|null
|
||||
*/
|
||||
@ -132,8 +142,8 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
{
|
||||
$index_key = $this->getConfig()['index_key'];
|
||||
|
||||
if (isset($this->children[$index_key])) {
|
||||
return $this->children[$index_key];
|
||||
if ($this->getLocalIndexPage()) {
|
||||
return $this->getLocalIndexPage();
|
||||
}
|
||||
|
||||
if ($this->getConfig()->shouldInheritIndex() && $first_page = $this->seekFirstPage()) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Todaymade\Daux\Tree;
|
||||
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
use Todaymade\Daux\Config;
|
||||
use Todaymade\Daux\Daux;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -47,7 +48,6 @@ class BuilderTest extends TestCase
|
||||
$config->setDocumentationDirectory('');
|
||||
$root = new Root($config);
|
||||
|
||||
|
||||
$dir = Builder::getOrCreateDir($root, 'directory');
|
||||
|
||||
$this->assertSame($root, $dir->getParent());
|
||||
@ -147,4 +147,52 @@ class BuilderTest extends TestCase
|
||||
$this->assertEquals('file.json', $entry->getUri());
|
||||
$this->assertInstanceOf('Todaymade\Daux\Tree\ComputedRaw', $entry);
|
||||
}
|
||||
|
||||
public function testScanner()
|
||||
{
|
||||
$structure = [
|
||||
'Page.md' => 'another page',
|
||||
'Button.md' => 'another page',
|
||||
'22.png' => ''
|
||||
];
|
||||
$root = vfsStream::setup('root', null, $structure);
|
||||
|
||||
$config = new Config;
|
||||
$config->setDocumentationDirectory($root->url());
|
||||
$config['valid_content_extensions'] = ['md'];
|
||||
$config['mode'] = Daux::STATIC_MODE;
|
||||
$config['index_key'] = 'index.html';
|
||||
|
||||
$tree = new Root($config);
|
||||
Builder::build($tree, []);
|
||||
|
||||
$this->assertEquals(
|
||||
['22.png', 'Button.html', 'Page.html'],
|
||||
array_keys($tree->getEntries())
|
||||
);
|
||||
}
|
||||
|
||||
public function testIndexFrontMatter()
|
||||
{
|
||||
$structure = [
|
||||
'folder' => [
|
||||
'index.md' => "---\ntitle: new Title\n---\nThe content",
|
||||
'Page.md' => 'another page',
|
||||
'Button.md' => 'another page'
|
||||
]
|
||||
];
|
||||
$root = vfsStream::setup('root', null, $structure);
|
||||
|
||||
$config = new Config;
|
||||
$config->setDocumentationDirectory($root->url());
|
||||
$config['valid_content_extensions'] = ['md'];
|
||||
$config['mode'] = Daux::STATIC_MODE;
|
||||
$config['index_key'] = 'index.html';
|
||||
|
||||
$tree = new Root($config);
|
||||
Builder::build($tree, []);
|
||||
|
||||
$this->assertTrue(array_key_exists('folder', $tree->getEntries()));
|
||||
$this->assertEquals('new Title', $tree->getEntries()['folder']->getTitle());
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren