Pass the original node on generation
This commit is contained in:
parent
d5458c5a0f
commit
d2b45a845f
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user