diff --git a/CHANGELOG.md b/CHANGELOG.md index 513d2b0..5d79cd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ + +# [3.2.0](https://github.com/flextype-plugins/twig/compare/v3.1.0...v3.2.0) (2022-09-13) + +### Features + +* **core** Add new functions `abs` and `round` for Math Extension. + +* **core** Add new filter `expressions`. + +* **core** Add new extensions `Fetch`. + + # [3.1.0](https://github.com/flextype-plugins/twig/compare/v3.0.0...v3.1.0) (2022-09-13) diff --git a/plugin.yaml b/plugin.yaml index 81979aa..c4d8766 100755 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: Twig -version: 3.1.0 +version: 3.2.0 description: Twig plugin to present Twig template engine for Flextype. icon: name: palette diff --git a/settings.yaml b/settings.yaml index bae191a..2b090cb 100644 --- a/settings.yaml +++ b/settings.yaml @@ -59,6 +59,7 @@ extensions: - Image - Url - Vars + - Fetch # Twig plugin priority priority: 0 diff --git a/src/twig/core/Extensions/FetchTwigExtension.php b/src/twig/core/Extensions/FetchTwigExtension.php new file mode 100644 index 0000000..254ce6f --- /dev/null +++ b/src/twig/core/Extensions/FetchTwigExtension.php @@ -0,0 +1,36 @@ +markdown()->parse($value) : ''; } + + public function expressions($value): string + { + return !empty($value) ? parsers()->expressions()->evaluate($value) : ''; + } } diff --git a/src/twig/core/Extensions/MathTwigExtension.php b/src/twig/core/Extensions/MathTwigExtension.php index c07c473..62cf128 100644 --- a/src/twig/core/Extensions/MathTwigExtension.php +++ b/src/twig/core/Extensions/MathTwigExtension.php @@ -31,6 +31,8 @@ public function getFunctions() : array return [ new TwigFunction('ceil', '\ceil'), new TwigFunction('floor', '\floor'), + new TwigFunction('round', '\round'), + new TwigFunction('abs', '\abs'), new TwigFunction('min', '\min'), new TwigFunction('max', '\max') ];