Permalink
Browse files

task latteSyntaxChecker: added all default macros

  • Loading branch information...
dg committed Mar 26, 2018
1 parent 55c057d commit 2509273f4db09335d1dadb868beeb7a871fe23ed
Showing with 10 additions and 3 deletions.
  1. +4 −1 composer.json
  2. +6 −2 src/Tasks.php
@@ -16,7 +16,10 @@
"nette/utils": "~2.4",
"nette/finder": "~2.4",
"nette/neon": "~2.4",
"latte/latte": "~2.4"
"latte/latte": "~2.4",
"nette/forms": "^2.4",
"nette/caching": "^2.5",
"nette/application": "^2.4"
},
"require-dev": {
"nette/tester": "^2.0",
@@ -161,9 +161,13 @@ public static function phpSyntaxChecker($contents, Result $result)
public static function latteSyntaxChecker($contents, Result $result)
{
$latte = new Latte\Engine;
$latte->setLoader(new Latte\Loaders\StringLoader);
$latte->getCompiler()->addMacro('cache', new Nette\Bridges\CacheLatte\CacheMacro);
Nette\Bridges\ApplicationLatte\UIMacros::install($latte->getCompiler());
Nette\Bridges\FormsLatte\FormMacros::install($latte->getCompiler());
try {
$latte = new Latte\Engine;
$latte->setLoader(new Latte\Loaders\StringLoader);
$latte->compile($contents);
} catch (Latte\CompileException $e) {
if (!preg_match('#Unknown (macro|attribute)#A', $e->getMessage())) {

0 comments on commit 2509273

Please sign in to comment.