Use the official twig StringLoaderExtension
Not sure how I missed the fact that this exists, but let's use it instead of an unofficial extension
This commit is contained in:
parent
08cfdcf460
commit
b2036b765f
3 changed files with 35 additions and 116 deletions
|
@ -14,7 +14,6 @@
|
||||||
"league/commonmark": "^2.3",
|
"league/commonmark": "^2.3",
|
||||||
"elgigi/commonmark-emoji": "^2.0",
|
"elgigi/commonmark-emoji": "^2.0",
|
||||||
"twig/twig": "^3.5",
|
"twig/twig": "^3.5",
|
||||||
"shapecode/twig-string-loader": "^1.1",
|
|
||||||
"donatello-za/rake-php-plus": "^1.0",
|
"donatello-za/rake-php-plus": "^1.0",
|
||||||
"embed/embed": "^4.4",
|
"embed/embed": "^4.4",
|
||||||
"nyholm/psr7": "^1.5"
|
"nyholm/psr7": "^1.5"
|
||||||
|
|
147
composer.lock
generated
147
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "2b32ca6ab5978e9e11f071023d5dd4c5",
|
"content-hash": "ea1fd1c14d6c8fe48dba5d365ff65efc",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/ca-bundle",
|
"name": "composer/ca-bundle",
|
||||||
|
@ -700,16 +700,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nette/utils",
|
"name": "nette/utils",
|
||||||
"version": "v3.2.8",
|
"version": "v3.2.9",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nette/utils.git",
|
"url": "https://github.com/nette/utils.git",
|
||||||
"reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368"
|
"reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368",
|
"url": "https://api.github.com/repos/nette/utils/zipball/c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c",
|
||||||
"reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368",
|
"reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -719,6 +719,7 @@
|
||||||
"nette/di": "<3.0.6"
|
"nette/di": "<3.0.6"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"jetbrains/phpstorm-attributes": "dev-master",
|
||||||
"nette/tester": "~2.0",
|
"nette/tester": "~2.0",
|
||||||
"phpstan/phpstan": "^1.0",
|
"phpstan/phpstan": "^1.0",
|
||||||
"tracy/tracy": "^2.3"
|
"tracy/tracy": "^2.3"
|
||||||
|
@ -779,9 +780,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nette/utils/issues",
|
"issues": "https://github.com/nette/utils/issues",
|
||||||
"source": "https://github.com/nette/utils/tree/v3.2.8"
|
"source": "https://github.com/nette/utils/tree/v3.2.9"
|
||||||
},
|
},
|
||||||
"time": "2022-09-12T23:36:20+00:00"
|
"time": "2023-01-18T03:26:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nyholm/psr7",
|
"name": "nyholm/psr7",
|
||||||
|
@ -1177,88 +1178,6 @@
|
||||||
},
|
},
|
||||||
"time": "2016-08-06T14:39:51+00:00"
|
"time": "2016-08-06T14:39:51+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "shapecode/twig-string-loader",
|
|
||||||
"version": "1.1.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/shapecode/twig-string-loader.git",
|
|
||||||
"reference": "c40d3a9f123e22f2e81f1c79d4d3a96455e21b2d"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/shapecode/twig-string-loader/zipball/c40d3a9f123e22f2e81f1c79d4d3a96455e21b2d",
|
|
||||||
"reference": "c40d3a9f123e22f2e81f1c79d4d3a96455e21b2d",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^7.4|^8.0",
|
|
||||||
"twig/twig": "^2.11|^3.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"doctrine/coding-standard": "^9.0",
|
|
||||||
"maglnet/composer-require-checker": "^2.0|^3.8|^4.0",
|
|
||||||
"phpstan/phpstan": "^1.4",
|
|
||||||
"phpstan/phpstan-deprecation-rules": "^1.0",
|
|
||||||
"phpstan/phpstan-phpunit": "^1.0",
|
|
||||||
"phpstan/phpstan-strict-rules": "^1.1",
|
|
||||||
"phpunit/phpunit": "^9.5",
|
|
||||||
"roave/security-advisories": "dev-master",
|
|
||||||
"squizlabs/php_codesniffer": "^3.4"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "1.1-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Shapecode\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Nikita Loges",
|
|
||||||
"email": "dev@loges.one",
|
|
||||||
"homepage": "https://loges.one"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "A string loader for twig",
|
|
||||||
"homepage": "https://github.com/shapecode/twig-string-loader",
|
|
||||||
"keywords": [
|
|
||||||
"loader",
|
|
||||||
"shapecode",
|
|
||||||
"string",
|
|
||||||
"template",
|
|
||||||
"twig"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"email": "support@shapecode.de",
|
|
||||||
"issues": "https://github.com/shapecode/twig-string-loader/issues",
|
|
||||||
"source": "https://github.com/shapecode/twig-string-loader/releases",
|
|
||||||
"wiki": "https://github.com/shapecode/twig-string-loader/wiki"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "http://paypal.me/nloges",
|
|
||||||
"type": "custom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://github.com/nicklog",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://liberapay.com/nicklog",
|
|
||||||
"type": "liberapay"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2022-01-15T12:43:29+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/deprecation-contracts",
|
"name": "symfony/deprecation-contracts",
|
||||||
"version": "v3.0.2",
|
"version": "v3.0.2",
|
||||||
|
@ -1857,16 +1776,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nikic/php-parser",
|
"name": "nikic/php-parser",
|
||||||
"version": "v4.15.2",
|
"version": "v4.15.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||||
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc"
|
"reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
|
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039",
|
||||||
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
|
"reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1907,9 +1826,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2"
|
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3"
|
||||||
},
|
},
|
||||||
"time": "2022-11-12T15:38:23+00:00"
|
"time": "2023-01-16T22:05:37+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phar-io/manifest",
|
"name": "phar-io/manifest",
|
||||||
|
@ -2024,16 +1943,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.9.11",
|
"version": "1.9.13",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464"
|
"reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/60f3d68481eef216199eae7a2603cd5fe124d464",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a0922426da3a7d0d9334e99a363f7f9f6e23e84f",
|
||||||
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464",
|
"reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2063,7 +1982,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||||
"source": "https://github.com/phpstan/phpstan/tree/1.9.11"
|
"source": "https://github.com/phpstan/phpstan/tree/1.9.13"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -2079,7 +1998,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-01-12T14:04:13+00:00"
|
"time": "2023-01-18T15:26:53+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
|
@ -2401,20 +2320,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "9.5.27",
|
"version": "9.5.28",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38"
|
"reference": "954ca3113a03bf780d22f07bf055d883ee04b65e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e",
|
||||||
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38",
|
"reference": "954ca3113a03bf780d22f07bf055d883ee04b65e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"doctrine/instantiator": "^1.3.1",
|
"doctrine/instantiator": "^1.3.1 || ^2",
|
||||||
"ext-dom": "*",
|
"ext-dom": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
|
@ -2483,7 +2402,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -2499,20 +2418,20 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-12-09T07:31:23+00:00"
|
"time": "2023-01-14T12:32:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector/rector",
|
"name": "rector/rector",
|
||||||
"version": "0.15.5",
|
"version": "0.15.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/rectorphp/rector.git",
|
"url": "https://github.com/rectorphp/rector.git",
|
||||||
"reference": "b27945f63527b540dba09a4f4612bc738da9c285"
|
"reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/b27945f63527b540dba09a4f4612bc738da9c285",
|
"url": "https://api.github.com/repos/rectorphp/rector/zipball/a43370e1f4c47aaa96c0f85bf9db73db1be7552f",
|
||||||
"reference": "b27945f63527b540dba09a4f4612bc738da9c285",
|
"reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2547,7 +2466,7 @@
|
||||||
"description": "Instant Upgrade and Automated Refactoring of any PHP code",
|
"description": "Instant Upgrade and Automated Refactoring of any PHP code",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/rectorphp/rector/issues",
|
"issues": "https://github.com/rectorphp/rector/issues",
|
||||||
"source": "https://github.com/rectorphp/rector/tree/0.15.5"
|
"source": "https://github.com/rectorphp/rector/tree/0.15.7"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -2555,7 +2474,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-01-12T19:13:08+00:00"
|
"time": "2023-01-13T21:14:19+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
|
|
|
@ -24,11 +24,12 @@ class AntTwig
|
||||||
$templatePath = AntTools::repairFilePath(antThemePath . '/' . $theme . '/' . 'Templates');
|
$templatePath = AntTools::repairFilePath(antThemePath . '/' . $theme . '/' . 'Templates');
|
||||||
|
|
||||||
$filesystemLoader = new \Twig\Loader\FilesystemLoader($templatePath);
|
$filesystemLoader = new \Twig\Loader\FilesystemLoader($templatePath);
|
||||||
$stringLoader = new \Shapecode\Twig\Loader\StringLoader();
|
$stringLoader = new \Twig\Extension\StringLoaderExtension();
|
||||||
$chainLoader = new \Twig\Loader\ChainLoader([$stringLoader, $filesystemLoader]);
|
$chainLoader = new \Twig\Loader\ChainLoader([$stringLoader, $filesystemLoader]);
|
||||||
$twigEnvironment = new \Twig\Environment($chainLoader, [
|
$twigEnvironment = new \Twig\Environment($chainLoader, [
|
||||||
'cache' => $twigCache,
|
'cache' => $twigCache,
|
||||||
'debug' => AntConfig::currentConfig('debug'),
|
'debug' => AntConfig::currentConfig('debug'),
|
||||||
|
'strict_variables' => AntConfig::currentConfig('debug'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $twigEnvironment->render($content, $params);
|
return $twigEnvironment->render($content, $params);
|
||||||
|
|
Loading…
Reference in a new issue