From 12739c2044c2e90ae66945f4fa991c434c1e4163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Goetz?= Date: Tue, 21 Jul 2015 09:51:55 +0200 Subject: [PATCH] Small fixes in url generations --- libs/Format/HTML/MarkdownPage.php | 3 ++- libs/Processor.php | 6 +++--- libs/Tree/Builder.php | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/Format/HTML/MarkdownPage.php b/libs/Format/HTML/MarkdownPage.php index 1f92c07..b5c8d49 100644 --- a/libs/Format/HTML/MarkdownPage.php +++ b/libs/Format/HTML/MarkdownPage.php @@ -40,7 +40,8 @@ class MarkdownPage extends \Todaymade\Daux\Format\Base\MarkdownPage $breadcrumb_trail = array(); if (!empty($parents)) { foreach ($parents as $node) { - $breadcrumb_trail[$node->getTitle()] = $node->getUrl(); + $page = $node->getIndexPage() ?: $node->getFirstPage(); + $breadcrumb_trail[$node->getTitle()] = $page? $page->getUrl() : ''; } } return $breadcrumb_trail; diff --git a/libs/Processor.php b/libs/Processor.php index f94ca65..df3c5f4 100644 --- a/libs/Processor.php +++ b/libs/Processor.php @@ -2,7 +2,7 @@ use League\CommonMark\Environment; use Symfony\Component\Console\Output\OutputInterface; -use Todaymade\Daux\Tree\Directory; +use Todaymade\Daux\Tree\Root; class Processor { @@ -38,9 +38,9 @@ class Processor * the tree as you want, move pages, modify * pages and even add new ones. * - * @param Directory $root + * @param Root $root */ - public function manipulateTree(Directory $root) + public function manipulateTree(Root $root) { } diff --git a/libs/Tree/Builder.php b/libs/Tree/Builder.php index 6d1e88d..ededa19 100644 --- a/libs/Tree/Builder.php +++ b/libs/Tree/Builder.php @@ -145,8 +145,10 @@ class Builder */ public static function getOrCreatePage(Directory $parent, $title) { - $slug = DauxHelper::slug($title); - $uri = $slug . ".html"; + $uri = $slug = DauxHelper::slug($title); + if ($parent->getConfig()['mode'] === Daux::STATIC_MODE) { + $uri = $slug . ".html"; + } if (array_key_exists($uri, $parent->getEntries())) { return $parent->getEntries()[$uri];