mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-06-15 20:25:19 +02:00
Making the templating component an optional dependency
It already basically was, but we were requiring it.
This commit is contained in:
parent
77d1412005
commit
91a268692e
6
CHANGELOG.md
Normal file
6
CHANGELOG.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
1.7
|
||||
===
|
||||
|
||||
* The MarkdownHelper Templating component integration (and corresponding
|
||||
`templating.helper.markdown` services) are no longer added unless you
|
||||
have the `symfony/templating` component installed.
|
|
@ -10,6 +10,7 @@ use Symfony\Component\DependencyInjection\Alias;
|
|||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
class KnpMarkdownExtension extends Extension
|
||||
{
|
||||
|
@ -29,7 +30,10 @@ class KnpMarkdownExtension extends Extension
|
|||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('parser.xml');
|
||||
// BC to support the PHP templates in the Templating component
|
||||
if (interface_exists(EngineInterface::class)) {
|
||||
$loader->load('helper.xml');
|
||||
}
|
||||
$loader->load('twig.xml');
|
||||
|
||||
if ('markdown.parser.sundown' == $config['parser']['service']) {
|
||||
|
|
|
@ -5,6 +5,9 @@ namespace Knp\Bundle\MarkdownBundle\Helper;
|
|||
use Knp\Bundle\MarkdownBundle\Parser\ParserManager;
|
||||
use Symfony\Component\Templating\Helper\HelperInterface;
|
||||
|
||||
/**
|
||||
* @deprecated The MarkdownHelper was deprecated in 1.7 and will be removed in 2.0.
|
||||
*/
|
||||
class MarkdownHelper implements HelperInterface
|
||||
{
|
||||
private $parserManager;
|
||||
|
@ -27,6 +30,8 @@ class MarkdownHelper implements HelperInterface
|
|||
*/
|
||||
public function transform($markdownText, $parserName = null)
|
||||
{
|
||||
trigger_error('The MarkdownHelper was deprecated in 1.7 and will be removed in KnpMarkdownBundle 2.0.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->parserManager->transform($markdownText, $parserName);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
"php": ">=5.5.9",
|
||||
"symfony/framework-bundle": "~2.8|~3.0|^4.0",
|
||||
"symfony/dependency-injection": "~2.8|~3.0|^4.0",
|
||||
"symfony/templating": "~2.8|~3.0|^4.0",
|
||||
"michelf/php-markdown": "~1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.5"
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"symfony/templating": "~2.8|~3.0|^4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/twig-bundle": "to use the Twig markdown filter",
|
||||
|
|
Loading…
Reference in a new issue