Skip to content

Commit

Permalink
n:class supports BEM (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich authored and dg committed May 17, 2017
1 parent 9f7a12a commit b46d7cb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Latte/Compiler/MacroTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function parse($s)
self::T_CAST => '\((?:expand|string|array|int|integer|float|bool|boolean|object)\)', // type casting
self::T_VARIABLE => '\$[\w\pL_]+',
self::T_NUMBER => '[+-]?[0-9]+(?:\.[0-9]+)?(?:e[0-9]+)?',
self::T_SYMBOL => '[\w\pL_]+(?:-[\w\pL_]+)*',
self::T_SYMBOL => '[\w\pL_]+(?:-+[\w\pL_]+)*',
self::T_CHAR => '::|=>|->|\+\+|--|<<|>>|<=>|<=|>=|===|!==|==|!=|<>|&&|\|\||\?\?|\?>|\*\*|\.\.\.|[^"\']', // =>, any char except quotes
], 'u');
return self::$tokenizer->tokenize($s);
Expand Down
2 changes: 1 addition & 1 deletion tests/Latte/expected/macros.n-macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<p class="foo odd">n:class</p>

<p>n:class empty</p>

<p class="bem--modifier">n:class with BEM</p>


<ul title="block + if + foreach">
Expand Down
2 changes: 1 addition & 1 deletion tests/Latte/expected/macros.n-macros.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Template%a% extends Latte\Runtime\Template
<p<?php if ($_tmp = array_filter(['foo', (false ? 'first' : NULL), 'odd', (true ? 'foo' : 'bar')])) echo ' class="', LR\Filters::escapeHtmlAttr(implode(" ", array_unique($_tmp))), '"' ?>>n:class</p>

<p<?php if ($_tmp = array_filter([false ? 'first' : NULL])) echo ' class="', LR\Filters::escapeHtmlAttr(implode(" ", array_unique($_tmp))), '"' ?>>n:class empty</p>

<p<?php if ($_tmp = array_filter([true ? 'bem--modifier' : NULL])) echo ' class="', LR\Filters::escapeHtmlAttr(implode(" ", array_unique($_tmp))), '"' ?>>n:class with BEM</p>


<?php
Expand Down
2 changes: 1 addition & 1 deletion tests/Latte/templates/macros.n-macros.latte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<p n:class="foo, (false ? first), odd, (true ? foo : bar)">n:class</p>

<p n:class="false ? first">n:class empty</p>

<p n:class="true ? bem--modifier">n:class with BEM</p>


<ul title="block + if + foreach" n:block="bl">
Expand Down

0 comments on commit b46d7cb

Please sign in to comment.