Added a content type system to be able to extend the conversion mechanism

Cette révision appartient à :
Stéphane Goetz
2015-07-28 17:25:03 +02:00
Parent 45328d5f4e
révision b5ce4f1d79
20 fichiers modifiés avec 232 ajouts et 37 suppressions

Voir le fichier

@ -5,6 +5,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Todaymade\Daux\Config;
use Todaymade\Daux\Console\RunAction;
use Todaymade\Daux\Daux;
use Todaymade\Daux\Format\Base\ContentTypes\ContentTypeHandler;
use Todaymade\Daux\Format\Confluence\CommonMark\CommonMarkConverter;
use Todaymade\Daux\Tree\Content;
use Todaymade\Daux\Tree\Directory;
@ -16,9 +17,6 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
/** @var string */
protected $prefix;
/** @var CommonMarkConverter */
protected $converter;
/** @var Daux */
protected $daux;
@ -28,7 +26,16 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
public function __construct(Daux $daux)
{
$this->daux = $daux;
$this->converter = new CommonMarkConverter(['daux' => $this->daux->getParams()]);
}
/**
* @return array
*/
public function getContentTypes()
{
return [
new ContentTypes\Markdown\ContentType($this->daux->getParams())
];
}
/**
@ -83,7 +90,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
$data = [
'title' => $this->prefix . $node->getTitle(),
'file' => $node,
'page' => MarkdownPage::fromFile($node, $params, $this->converter),
'page' => ContentPage::fromFile($node, $params, $this->daux->getContentTypeHandler()->getType($node)),
];
// As the page is lazily generated