-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from pug-php/symfony-5
Allow Symfony 5
- Loading branch information
Showing
51 changed files
with
1,158 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
use Twig\Environment; | ||
use Twig\Source; | ||
use Twig\Template; | ||
|
||
/* {{filename}} */ | ||
class PugDebugTemplateTemplate extends Template | ||
{ | ||
private $source; | ||
private $macros = []; | ||
|
||
public function __construct(Environment $env) | ||
{ | ||
parent::__construct($env); | ||
$this->source = $this->getSourceContext(); | ||
$this->parent = false; | ||
$this->blocks = []; | ||
} | ||
|
||
protected function doDisplay(array $context, array $blocks = []) | ||
{ | ||
$macros = $this->macros; | ||
extract($context); | ||
|
||
if (isset($this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"])) { | ||
$__internal_1 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"]; | ||
$__internal_1->enter($__internal_1_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "{{filename}}")); | ||
} | ||
|
||
if (isset($this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"])) { | ||
$__internal_2 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; | ||
$__internal_2->enter($__internal_2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "{{filename}}")); | ||
} | ||
|
||
// {{code}} | ||
|
||
if (isset($__internal_1)) { | ||
$__internal_1->leave($__internal_1_prof); | ||
} | ||
|
||
if (isset($__internal_2)) { | ||
$__internal_2->leave($__internal_2_prof); | ||
} | ||
} | ||
|
||
public function getTemplateName() | ||
{ | ||
return "{{filename}}"; | ||
} | ||
|
||
public function isTraitable() | ||
{ | ||
return false; | ||
} | ||
|
||
public function getDebugInfo() | ||
{ | ||
return [/* {{debugInfo}} */]; | ||
} | ||
|
||
public function getSourceContext() | ||
{ | ||
return new Source("{{source}}", "{{filename}}", "{{path}}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
use Twig\Environment; | ||
use Twig\Source; | ||
use Twig\Template; | ||
|
||
/* {{filename}} */ | ||
class PugTemplateTemplate extends Template | ||
{ | ||
private $source; | ||
private $macros = []; | ||
|
||
public function __construct(Environment $env) | ||
{ | ||
parent::__construct($env); | ||
$this->source = $this->getSourceContext(); | ||
$this->parent = false; | ||
$this->blocks = []; | ||
} | ||
|
||
protected function doDisplay(array $context, array $blocks = []) | ||
{ | ||
$macros = $this->macros; | ||
extract($context); | ||
// {{code}} | ||
} | ||
|
||
public function getTemplateName() | ||
{ | ||
return "{{filename}}"; | ||
} | ||
|
||
public function isTraitable() | ||
{ | ||
return false; | ||
} | ||
|
||
public function getDebugInfo() | ||
{ | ||
return [/* {{debugInfo}} */]; | ||
} | ||
|
||
public function getSourceContext() | ||
{ | ||
return new Source("", "{{filename}}", "{{path}}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Pug\Twig; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class EnvironmentTwig1 extends EnvironmentBase | ||
{ | ||
public function compileSource($source, $name = null) | ||
{ | ||
return $this->compileSourceBase($source); | ||
} | ||
|
||
public function render($name, array $context = []) | ||
{ | ||
return $this->renderBase($name, array_merge($this->pugSymfonyEngine->getSharedVariables(), $context)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Pug\Twig; | ||
|
||
use Twig\Source; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class EnvironmentTwig2 extends EnvironmentBase | ||
{ | ||
public function compileSource(Source $source) | ||
{ | ||
return $this->compileSourceBase($source); | ||
} | ||
|
||
public function render($name, array $context = []) | ||
{ | ||
return $this->renderBase($name, array_merge($this->pugSymfonyEngine->getSharedVariables(), $context)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Pug\Twig; | ||
|
||
use Twig\Source; | ||
use Twig\Template; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class EnvironmentTwig3 extends EnvironmentBase | ||
{ | ||
/** | ||
* @var string[] | ||
*/ | ||
protected $classNames = []; | ||
|
||
public function compileSource(Source $source): string | ||
{ | ||
return $this->compileSourceBase($source); | ||
} | ||
|
||
public function loadTemplate(string $cls, string $name, int $index = null): Template | ||
{ | ||
if ($index !== null) { | ||
$cls .= '___' . $index; | ||
} | ||
|
||
$this->classNames[$name] = $cls; | ||
|
||
return parent::loadTemplate($cls, $name, $index); | ||
} | ||
|
||
public function render($name, array $context = []): string | ||
{ | ||
return $this->renderBase($name, array_merge($this->pugSymfonyEngine->getSharedVariables(), $context)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Jade\Exceptions; | ||
|
||
use RuntimeException; | ||
use Throwable; | ||
|
||
class ReservedVariable extends RuntimeException | ||
{ | ||
public function __construct($variableName, $code = 0, Throwable $previous = null) | ||
{ | ||
parent::__construct("$variableName is a reserved variable name, you can't overwrite it.", $code, $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Jade\JadeSymfonyBundle\Command; | ||
|
||
use Pug\PugSymfonyEngine; | ||
use Symfony\Component\Console\Command\Command; | ||
|
||
abstract class PugAwareCommand extends Command | ||
{ | ||
protected $pugSymfonyEngine; | ||
|
||
public function __construct(PugSymfonyEngine $pugSymfonyEngine) | ||
{ | ||
$this->pugSymfonyEngine = $pugSymfonyEngine; | ||
parent::__construct(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.