Pass the original node on generation

This commit is contained in:
Stéphane Goetz 2015-07-31 12:53:22 +02:00
parent d5458c5a0f
commit d2b45a845f
4 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,7 @@
<?php namespace Todaymade\Daux\ContentTypes;
use Todaymade\Daux\Config;
use Todaymade\Daux\Tree\Content;
interface ContentType
{
@ -13,5 +14,10 @@ interface ContentType
*/
public function getExtensions();
public function convert($html);
/**
* @param string $raw The raw text to render
* @param Content $node The original node we are converting
* @return string The generated output
*/
public function convert($raw, Content $node);
}

View File

@ -1,6 +1,7 @@
<?php namespace Todaymade\Daux\ContentTypes\Markdown;
use Todaymade\Daux\Config;
use Todaymade\Daux\Tree\Content;
class ContentType implements \Todaymade\Daux\ContentTypes\ContentType
{
@ -24,8 +25,8 @@ class ContentType implements \Todaymade\Daux\ContentTypes\ContentType
return ['md', 'markdown'];
}
public function convert($html)
public function convert($raw, Content $node)
{
return $this->converter->convertToHtml($html);
return $this->converter->convertToHtml($raw);
}
}

View File

@ -98,6 +98,8 @@ class Daux
) {
throw new Exception('The Docs directory does not exist. Check the path again : ' . $this->docs_path);
}
$this->options['docs_path'] = $this->docs_path;
}
/**

View File

@ -51,7 +51,7 @@ abstract class ContentPage extends SimplePage
protected function convertPage($content)
{
return $this->contentType->convert($content);
return $this->contentType->convert($content, $this->getFile());
}
protected function generatePage()