Skip to content

Commit

Permalink
Fixed The "Grav/Common/Twig/TwigExtension" extension is not enabled
Browse files Browse the repository at this point in the history
… when using markdown twig tag [#3317]
  • Loading branch information
mahagr committed Apr 19, 2021
1 parent fb8d769 commit 5efe447
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.7.13
## mm/dd/2021

1. [](#bugfix)
* Fixed `The "Grav/Common/Twig/TwigExtension" extension is not enabled` when using markdown twig tag [#3317](https://github.com/getgrav/grav/issues/3317)

# v1.7.12
## 04/15/2021

Expand Down
4 changes: 2 additions & 2 deletions system/src/Grav/Common/Twig/Extension/FilesystemExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
use Twig\TwigFunction;

/**
* Class TwigExtension
* @package Grav\Common\Twig
* Class FilesystemExtension
* @package Grav\Common\Twig\Extension
*/
class FilesystemExtension extends AbstractExtension
{
Expand Down
6 changes: 3 additions & 3 deletions system/src/Grav/Common/Twig/Extension/GravExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
use function strlen;

/**
* Class TwigExtension
* @package Grav\Common\Twig
* Class GravExtension
* @package Grav\Common\Twig\Extension
*/
class GravExtension extends AbstractExtension implements GlobalsInterface
{
Expand All @@ -76,7 +76,7 @@ class GravExtension extends AbstractExtension implements GlobalsInterface
protected $config;

/**
* TwigExtension constructor.
* GravExtension constructor.
*/
public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Twig/Node/TwigNodeMarkdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ public function compile(Compiler $compiler): void
->write('$lines = explode("\n", $content);' . PHP_EOL)
->write('$content = preg_replace(\'/^\' . $matches[0]. \'/\', "", $lines);' . PHP_EOL)
->write('$content = join("\n", $content);' . PHP_EOL)
->write('echo $this->env->getExtension(\'Grav\Common\Twig\TwigExtension\')->markdownFunction($context, $content);' . PHP_EOL);
->write('echo $this->env->getExtension(\'Grav\Common\Twig\Extension\GravExtension\')->markdownFunction($context, $content);' . PHP_EOL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

use Codeception\Util\Fixtures;
use Grav\Common\Grav;
use Grav\Common\Twig\TwigExtension;
use Grav\Common\Twig\Extension\GravExtension;

/**
* Class TwigExtensionTest
* Class GravExtensionTest
*/
class TwigExtensionTest extends \Codeception\TestCase\Test
class GravExtensionTest extends \Codeception\TestCase\Test
{
/** @var Grav $grav */
protected $grav;

/** @var TwigExtension $twig_ext */
/** @var GravExtension $twig_ext */
protected $twig_ext;

protected function _before(): void
{
$this->grav = Fixtures::get('grav');
$this->twig_ext = new TwigExtension();
$this->twig_ext = new GravExtension();
}

public function testInflectorFilter(): void
Expand Down

0 comments on commit 5efe447

Please sign in to comment.