From 276f86236efd4cd9219b26e33e52923c46571e08 Mon Sep 17 00:00:00 2001 From: kylekatarnls Date: Thu, 30 Jun 2016 23:23:13 +0200 Subject: [PATCH] Allow .pug or any custom (single or multiple) extensions --- composer.json | 2 +- composer.lock | 95 ++++++++++++++++++++++++++++++++++ src/Jade/JadeSymfonyEngine.php | 8 ++- 3 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 composer.lock diff --git a/composer.json b/composer.json index 1508fda..601966e 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description": "Pug template engine for Symfony", "type": "library", "require": { - "pug-php/pug": "^1.8" + "pug-php/pug": "^1.12.2" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..ae188db --- /dev/null +++ b/composer.lock @@ -0,0 +1,95 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "9f82f7acd44b7c6c8f4f24603f215179", + "content-hash": "53fbc5bab47e325ef95578bdecc8d6c5", + "packages": [ + { + "name": "pug-php/pug", + "version": "1.12.2", + "source": { + "type": "git", + "url": "https://github.com/pug-php/pug.git", + "reference": "341f10bc964881946c90d98e80477c4533889def" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pug-php/pug/zipball/341f10bc964881946c90d98e80477c4533889def", + "reference": "341f10bc964881946c90d98e80477c4533889def", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "replace": { + "kylekatarnls/jade-php": "self.version" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "phpunit/phpunit": ">=4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Pug\\": "src/", + "Jade\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryasho", + "email": "konstantin.kudryashov@knplabs.com", + "homepage": "http://about.me/everzet", + "role": "Developer" + }, + { + "name": "Janez Troha", + "email": "janez.troha@gmail.com", + "homepage": "http://flavors.me/dz0ny", + "role": "Maintainer" + }, + { + "name": "Luke GB", + "email": "git@lukegb.com", + "homepage": "http://twitter.com/lukegb", + "role": "Maintainer" + }, + { + "name": "Ronan Tessier", + "email": "ronan.tessier@vaconsulting.lu", + "homepage": "http://github.com/ronan-gloo", + "role": "Maintainer" + }, + { + "name": "kylekatarnls", + "homepage": "http://github.com/kylekatarnls", + "role": "Maintainer" + } + ], + "description": "HAML-like template engine for PHP 5.3", + "homepage": "https://github.com/pug-php/pug", + "keywords": [ + "jade", + "minification", + "pug", + "template" + ], + "time": "2016-06-30 20:18:55" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/src/Jade/JadeSymfonyEngine.php b/src/Jade/JadeSymfonyEngine.php index e16af67..0a567c7 100644 --- a/src/Jade/JadeSymfonyEngine.php +++ b/src/Jade/JadeSymfonyEngine.php @@ -114,7 +114,13 @@ public function exists($name) public function supports($name) { - return substr($name, -5) === $this->getOption('extension'); + foreach ($this->jade->getExtensions() as $extension) { + if (substr($name, -strlen($extension)) === $extension) { + return true; + } + } + + return false; } public function offsetGet($name)